سؤال

I switch to root user like so:

$ sudo su -

And then I try to run something like birdc

[root@localhost ~]# birdc
Unable to connect to server control socket (/usr/local/var/run/bird.ctl): 
No such file or directory

I find that I still need to sudo to run commands like the one above:

[root@localhost ~]# sudo birdc
BIRD 1.4.2 ready.
bird> 

What am I doing wrong? Is this something to do with the way I have installed BIRD?

هل كانت مفيدة؟

المحلول

There appears to be something wrong with your root login scripts. As a test, try doing sudo su without the -. This will change users without creating a login shell.

To figure out what your root login scripts are doing, run

printenv > /tmp/before
sudo su -
printenv > /tmp/after
diff /tmp/before /tmp/after

and then do the same thing again from a new user shell, but without the - arg to su. I bet you will see something.

However every program on a Linux system should be able to run with a root login shell. You need to configure your system in a way that it works with both su and su -. Meaning settings paths and permissions the right way. Have a look on a vanilla Ubuntu for example. It will work with su and su -

نصائح أخرى

It might have to do with your PATH or some other environment variables. When you do sudo, the environment configuration you have as your username stays. However, when you do su - and login as root, the environment configuration changes.

But(!) every program on a Linux system should be able to run with a root login shell. You need to configure your system in a way that it works with both su and su -. Meaning settings paths and permissions the right way. Have a look on a vanilla Ubuntu for example. It will work with su and su -

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top