Saturday, May 24, 2008

Enabling/Disabling 'sudo' for Local User(s)

Fedora/RedHat based distros doesn't give sudo power to local users by default, So its the root who grants them the power. Here's a way:

1> Open Terminal / Konsole and then login as root :
$ su -

2> Change the permission of /etc/sudoers to read-write mode :
# chmod u=rw /etc/sudoers

3> Open the file using a texteditor (I am using vim) and search for :
# vim /etc/sudoers

## Allow root to run any commands anywhere
root ALL=(ALL) ALL
Below that add (by i in vim) this:
username ALL=(ALL) ALL
Note: Here you can add or remove users and may have more than one user

4> Save and close the file ( Q then wq in vim) and change permission back to default :
# chmod u=r /etc/sudoers

Alternatively you can also go for :
$ su -c /usr/sbin/visudo
It will open sudoers file in rw mode in vim editor

2 comments:

Kaustav Acharya said...

Nice one bro... Remember, we were having soo many probs with sudo once... ? with bluez...
Cool blog..

Anant Khaitan said...

Thanks for the compliment.. you know yours is the first comment in my blog.. As for the sudo problem is concerned all the credits goes to you...