Some of the distro uses sudo to gaim access to run root privilage commands. But some of the distro do not include sudo by default such as FC5. To run some root privilage programs, you need to login as root by using su and gives root password.
Sometimes admin would not like to give away the root password to the user but admin still wants to allow certain root access to specific users. With that sudo comes to help.
To allow sudo for a certain user, you need to edit /etc/sudoers by typing
Visudo will actually open /etc/sudoers for edit. Add in the line like this.
# User privilege specification root ALL=(ALL) ALL foobar ALL=(ALL) ALL
Adding foobar to allow it access ALL root privilage commands and files.
By using that, user foobar can access root privilage commands easily such as iptables by doing this
sudo iptables -L
By type your own user password, you can access root privilage commands. But sometimes certain distro do not include certain path for user, such as /sbin, which contains a lots of root privilage commands. Therefore you cannot sudo straight forward. But there are two solution for that.
- export /sbin to path
- sudo login to root user.
To export /sbin into path, the best way is edit .bashrc at your home directory, add in the line
After that source your .bashrc and try again.
Login as root with sudo is more simple,
sudo su -
Somehow certain distro do not support sudo -i.
User always need to enter user password when you trigger sudo to access root privilage commands, that is somehow irritating. To overcalm this, you can allows the user by running sudo without need to type password, edit /etc/sudoers, modify the foobar line to become this
foobar ALL=(ALL) NOPASSWD: ALL