LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 05-24-2014, 09:16 AM   #1
casperdaghost
Member
 
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.
Code:
[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]#
Code:
DESCRIPTION
       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

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

[/CODE]

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?


Code:
SYNOPSIS
       su [options] [-] [user [argument...]]

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



OPTIONS
       -c, --command=command
              Pass command to the shell with the -c option.
 
Old 05-24-2014, 12:21 PM   #2
Hangdog42
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;

Code:
/etc/group
    Group account information. 
/etc/gshadow
    Secure group account information. 
/etc/passwd
    User account information. 
/etc/shadow
    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

Code:
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 12:23 PM.
 
  


Reply


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 01:55 AM
what the difference between usermod -G usermod -g LittleMaster Linux - Newbie 3 10-09-2012 04:26 AM
visudo noonmid27 Linux - Newbie 8 02-23-2007 05:42 PM
Need help with visudo powadha Debian 2 12-19-2004 06:04 AM
visudo xviddivxoggmp3 Slackware 7 08-17-2004 09:19 PM


All times are GMT -5. The time now is 01:16 PM.

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