Setup sudo

26 October 2006 Fedora Core, like all other Linux distributions, has a root user and has individual users. The root is the “superuser”, somewhat similar to “Administrator” in Windows.
Use your personal account for daily use root only for adminstration/configuration. To run as ‘root’ use su or sudo. However sudo requires setup. As root run:

echo 'loginname ALL=(ALL) ALL' >> /etc/sudoers

Where 'loginname' is your user account.
Use 'ALL=(ALL) NOPASSWD:ALL' if you don't want to be prompted a password.
If you are prompted for a password with 'sudo' it is the user password, not root.
Example:
[mirandam@charon ~]$ su
Password:    <--- Enter root password

[root@charon mirandam]# chmod +w /etc/sudoers
[root@charon mirandam]# echo 'mirandam ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
[root@charon mirandam]# chmod -w /etc/sudoers
[root@charon mirandam]# exit
exit
NOTE: Some users mentioned they require permissions change (chmod) because /etc/sudoers was read-only. However, I was able to run the above command with the file read-only.
The following is an example of how sudo lets you execute root commands:
[mirandam@charon ~]$ du -sh /root
du: `/root': Permission denied  <--- Fails!!!

[mirandam@charon ~]$ sudo du -sh /root
163M    /root                   <--- Works!!!
NOTE: Every command provided on this page will work if you remove sudo from the command. However this requires you must be logged in as ‘root’.
Top Resources

0 Response to "Setup sudo"

Posting Komentar