how does permission works to run sbin command on m

2019-03-05 05:08发布

问题:

i'm using mac os x and i was trying to run shutdown command but it says i'm not a superuser.

However, i could run ifconfig without being super user.

Both command are in /sbin.

And my PATH environment variable include /sbin ( is that why i can run ifconfig..?).

From what i have found, it says that

/sbin

for scripts with superuser (root) privileges required.

But i'm not quite sure about this explanation..

I'd appreciate all your help..

回答1:

it means that you must be superuser (the owner of the machine) to run those commands, for example:

sudo shutdown 

it will ask for a password, you must type the main user's password (the typing will not print out the password's chars) and press enter so you can confirm you are the super user.

sudo allows a permitted user to execute a command as the superuser or another user, as specified in the sudoers file. more: http://ss64.com/bash/sudo.html