문제

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