LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-02-2004, 09:56 PM   #1
namgor
LQ Newbie
 
Registered: Jun 2004
Posts: 28

Rep: Reputation: 15
is this useradd statements correct?


i m still kind of new to linux, i have done man useradd and man groupadd, stil unsure, pls check this for me:

objective:
- add group a, b,
- add user u1 into both group, and root into group b

is the following stmts correct?

groupadd a
groupadd b
useradd -g a u1
useradd -g b -M u1
useradd -g b -M root

thank you.
 
Old 07-03-2004, 12:13 AM   #2
comp12345
Member
 
Registered: Feb 2004
Posts: 467

Rep: Reputation: 30
For the secondary group use -G. The -g sets the primary group, so the fourth command resets the primary group of u1 from a to b (i.e. u1 belongs to group b, not a and b). You could combine lines 3 and 4 into one line:
Code:
useradd -g a -G b -M u1
Also, the root account is a default account so it will already exist. The command
Code:
useradd -g b -M root
will give you an error. Use usermod to change the profile of an existing account. Your command becomes
Code:
usermod -g b root
Note: The effects do not show until you relogin.

Last edited by comp12345; 07-03-2004 at 12:22 AM.
 
Old 07-03-2004, 12:18 AM   #3
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
the groupadd commands are correct, but don't use useradd to modify existing accounts. instead, use usermod. so the command would be, for example,
Code:
usermod -G a,b u1
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
if else statements 0.o Programming 7 09-27-2005 02:59 PM
if statements and case statements not working in bourne shell script mparkhurs Programming 3 06-12-2004 02:41 AM
if statements thesnaggle Linux - Software 1 02-16-2004 09:52 AM
How do I use X =< Y w/ IF statements? dolvmin Linux - Software 11 09-24-2003 10:39 PM
if then statements vapor Programming 4 07-16-2003 06:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:08 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
Open Source Consulting | Domain Registration