What is the difference between the two super user commands, su -s and sudo -s?
They both give a shell with access to the superuser account.
|
feedback
|
|
In practice, they will both make you the superuser. However, they do slightly different things, in slightly different ways. First, Secondly, If you want to be really cute, you can also run If the root user is locked (such as on Ubuntu), you will not be able to login as root using | |||||
feedback
|
Will switch to a user (in this case root) and launch the shell you specify, or one of few other methods of determining the shell. This is useful if you want to use zsh or another shell as root really quick... and for some reason you're not using sudo.
Just executes a shell using sudo, which would give you a root shell. You can pass a shell to it as well. su -s is older, much older then the sudo -s command. My guess is that the developer is trying to make it as easy as possible to switch to using sudo. | |||
|
feedback
|
|
su is a command to change to another user, either to run a shell or execute a specific command. You must authenticate as the other user. If you want to su to root, you need the root password. sudo is a command to execute another command (optionally a shell) as a different user. You must authenticate as your own user. Permission to use sudo (and the specific things you can do with it) are specified by an administrator in the sudoers file. If you give someone access to su (by, for example, giving them the root password), then they can do anything with it – run other commands, open a shell, change the password, login remotely via ssh, and so on. You're essentially giving them access to the other account, with 'su' being just one thing they can do with it. sudo is much more fine-grained. You can grant privileges to a user, or to a group. You can allow a user or group to sudo within a certain timeframe (e.g. Monday to Friday, 9 AM to 5 PM). You can specify a specific list of commands they're allowed to run (e.g. only /usr/local/bin/run_backup) or you can specify a specific user they're allowed to run commands as (e.g. www, backup, staff, etc). Besides its flexibility, sudo is a better solution in all cases, because it doesn't require access to anything the user doesn't already have. If you give someone sudo access, you can revoke it by removing their line in the sudoers file, or removing them from the sudoers group. If you delete their account, their access is gone. If you give them the root password, even assuming they don't do anything unpleasant with it, then they will know it forever. If you have multiple people who need root access for administrative tasks, this means either changing all the root passwords whenever someone leaves, or assuming that it's ok for them to have full access to your systems after you leave. | |||
|
feedback
|
| |||||
feedback
|
|
From Wikipedia:
| |||
|
feedback
|
|
On systems where the superuser account is disabled, such as Mac OS X, Also, it appears there is no | |||
feedback
|
|
This introduction may help you. | |||
|
feedback
|
|
su will basically create a new login shell with another user privileges (login) sudo will just temporarily allow you to execute command using the user you specified. On some UNIX like FreeBDS there are no '-s' options. | |||
|
feedback
|
|
One thing that isn't getting said fully is this: which one you can use often depends on what distribution you're using and who runs it. One or the other ( Finally, if you want to use | |||
|
feedback
|