Limit Permissions with sudo
One of things that seperates Ubuntu (or Debian based distribution) from other Linux distributions is that it disables the root account. For other distros such as Red Hat and SUSE, you are prompted for root password when it’s needed to perform a job or execute a command. You just log on as root or change to root with su. Since Ubuntu doesn’t have any root password by default, you use sudo to run a command as root. sudo allows access to root with controls over what a person can do as root. sudo prompts you for your password, which allows regular users to have some root access without knowing the root password.
The default sudo configuration in Ubuntu can be found in the /etc/sudoers file. It should always be edited with the visudo tool, not any standard text editor, as it perform extra validation checks for syntax errors. The default sudoers file looks like this:
# User privilege specification
root ALL=(ALL) ALL# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
The first rule allows root to use sudo to become any other user on the system, and the second rule allows anyone who is a member of the admin group to run any command as root. So when you want to run a command as root on a default Ubuntu system, type sudo followed by the command to run. For instance if you wanted to run apt-get update as root, you would type:
$ sudo apt-get update
To limit permissions for a user when using sudo, we can specify which applications it can run as root. For instances:
pavs ALL=(root) /usr/bin/find, /bin/rm
In this example the user pavs can only use the command “find” and “rm” as root.
However most users from other distros would probably prefer using su instead of sudo. To do that in ubuntu just set a password for root: $ sudo passwd root . Now you can log in as root or use su and sudo. You have the best of all worlds. ;)
