Saturday, April 7, 2012

Fedora 16 :: Adding A User to the Sudoers file

Fedora 16 installs without giving the default user sudo rights...unlike some other Linux distributions, and I needed admin rights to update my system.  I did a little Google search and came across's tutorial for adding a user to the sudoer's file

The tutorial esentially states to change the sudoers fileto write permissions that you can echo  '"user ALL=(ALL) ALL and appened it into the /etc/sudoers file. 

 [thenderson@localhost Documents]$ ls -l /etc/sudoers
-r--r-----. 1 root root 3338 Nov 30  2010 /etc/sudoers
[root@localhost Documents]$ chmod +w /etc/sudoers

[root@localhost Documents]$
[root@localhost Documents]$ echo "user ALL=(ALL) ALL >> /etc/sudoers
[user@localhost Documents]$
[root@localhost Documents]$ su user 
[user@localhost Documents]$ sudo ls /root
[user@localhost Documents]$ Operation not permitted  

Unfortunately this didn't work for me.  As you can see the error "Operation not permitted." So I figured I"d write about a little blurb on how I got this to work in Fedora 16.

Using 'visudo' worked for me.  Here's how simply this was done:


** If you need a VI editor cheatsheet click here

At the bottom of the sudoers file enter in your username in the following format

user ALL=(ALL) ALL

 Let's explain this full line

user - pretty self explaintory, this is your username
1st ALL - User can execute as all users
(ALL) - User can act as any user
3d ALL - user can run all commands

Append this line to bottom of /etc/sudoers file users ALL=(ALL) ALL then save the file.  That's it!  Now test it with something like this: 

[user@localhost ~]$ sudo ls /root
[user@localhost ~]$ 

If you get the following, you've done something wrong, so go back and check your syntax:

[user@localhost ~]$ ls /root
ls: cannot open directory /root: Permission denied

Any questions concerns, or critizism let me know.

No comments:

Post a Comment