Monday, May 21, 2007

sudo vs su -

The "sudo" command allows users specified in a sudoers file which is usually located in the /etc directory to perform certain functions (again, as permitted by the sudoers file) that are normally reserved for the root user. The syntax would be something like:

sudo command

where command is normally limited to the root user. You may be prompted for your normal user password, and if the root user has given you permission (in the sudoers file) to perform that action, you can.

The "su" command is a "switch user" command. In its simplest form, typing "su" will prompt you for the root password and if given correctly you get root privileges. Typing "su -" and giving the correct password gives you root's privileges and environment. The "su" command can also be used to gain access to another "normal" user's account if you have that user's password. To do that you would type "su " where is a valid normal user on that system.

No comments: