Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-24-2014, 08:16 AM   #1
Registered: Aug 2009
Posts: 349

Rep: Reputation: 16
using usermod vs editing with visudo

I tired using the 'usermod' commandto add my user to the sudoers file.
it did not work.
[root@new-host-3 FEDORA_CASPER]# su -c " usermod -g wheel FEDORA_CASPER"
[root@new-host-3 FEDORA_CASPER]#
[root@new-host-3 FEDORA_CASPER]#
       The usermod command modifies the system account files to reflect the changes that are specified on the command line.
What files does the usermod command change - because it was not the /etc/sudoers file.
also what is the wheel and why i had to use the -c (command) flag

[FEDORA_CASPER@new-host-3 ~]$ cat /etc/issue
Fedora release 20 (Heisenbug)
Kernel \r on an \m (\l)


I ended up adding my user to the /etc/sudoers file with visudo command - is this ok?
Is this how you add users to the Fedora system?

       su [options] [-] [user [argument...]]

       su allows to run commands with a substitute user and group ID.

       -c, --command=command
              Pass command to the shell with the -c option.
Old 05-24-2014, 11:21 AM   #2
LQ Veteran
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
If you read a bit farther down in the usermod man file, you'll see the files it modifies;

    Group account information. 
    Secure group account information. 
    User account information. 
    Secure user account information
And yes, visudo is the right way to modify the sudoers file. It checks the syntax when you're done editing and will complain if you've done something wrong. Also, you don't have to use vi to use visudo. The visudo command will use whatever editor the EDITOR environment variable specifies, so if you run

export EDITOR=nano
then it would use nano instead of vi.

Adding users to Fedora would be done with useradd, not usermod or visudo. You only use visudo when you want a user to have sudo privileges.

Last edited by Hangdog42; 05-24-2014 at 11:23 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] visudo fatalerror0x00 Linux - Newbie 7 11-25-2012 12:55 AM
what the difference between usermod -G usermod -g LittleMaster Linux - Newbie 3 10-09-2012 03:26 AM
visudo noonmid27 Linux - Newbie 8 02-23-2007 04:42 PM
Need help with visudo powadha Debian 2 12-19-2004 05:04 AM
visudo xviddivxoggmp3 Slackware 7 08-17-2004 08:19 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:27 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration