LinuxQuestions.org
Help answer threads with 0 replies.
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 01-04-2005, 11:02 PM   #1
Wolvastur
LQ Newbie
 
Registered: Dec 2004
Location: Mexico
Distribution: Slack
Posts: 5

Rep: Reputation: 0
useradd command


I've had trouble when i try to use useradd command with the -D option, when I get help its shown as if the -D option and the option without it cant mix, any help???

Thanks a lot....
 
Old 01-04-2005, 11:17 PM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
I've never used that switch (I haven't even used useradd much) but it seems like it shows or sets the defaults. If that's what you're trying to do, that should be it. Without it (normal process) you're just adding a user and that should work. Not sure what the precise problem you're having is. Which options do you wish to combine? Are you trying to use the '-d' option (different from -D)?

But the reason I hardly ever use useradd is that Slack comes with an 'adduser' script which has always been all I needed.
 
Old 01-04-2005, 11:31 PM   #3
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
useradd -D [-g default_group] [-b default_home]
[-e default_expire_date] [-f default_inactive]
[-s default_shell]

you gotta love those man pages
 
Old 01-04-2005, 11:33 PM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
I tend to find "adduser" a lot better than "useradd" coz it's an intereactive program and you don't need much Linux/Unix experience to understand it.
 
Old 01-05-2005, 12:42 AM   #5
IchBin
Member
 
Registered: Dec 2004
Distribution: Tinysofa Classic
Posts: 75

Rep: Reputation: 15
Quote:
Originally posted by foo_bar_foo
useradd -D [-g default_group] [-b default_home]
[-e default_expire_date] [-f default_inactive]
[-s default_shell]

you gotta love those man pages
Yes, but I think they need to include written examples. The above info doesn't tell a newbie how it should be exactly. If I were new I probably would type something like useradd -D -g default_group -b default_home etc. which doesn't work. Not too many man pages give good examples IMO.
 
Old 01-05-2005, 11:02 AM   #6
Wolvastur
LQ Newbie
 
Registered: Dec 2004
Location: Mexico
Distribution: Slack
Posts: 5

Original Poster
Rep: Reputation: 0
Well, I've tried to combine this:
useradd -D -b home_dir -g group_name -G additional_groups -s shell_name name_of_user

but it seems i cannot use the -D options with the others (-G is one of the other options I'd like to do).

And I chose to use useradd because later I'd like to do a script, and another question comes to my mind, with what languague is the script done?,can I use C/C++, sell scripting perl or what?.

Thanks a lot Im really around here.
 
Old 01-05-2005, 11:10 AM   #7
bitfuzzy
Member
 
Registered: Nov 2003
Location: NY
Distribution: slackware
Posts: 357

Rep: Reputation: 98
I'd have to agree with adduser being easier to use @ command line, but not so easy to use with a script

useradd -d is used as follows:

useradd <username> -d <homedir> -g <group> -s <dflt shell> -c <users name> -p <password>
 
Old 01-25-2005, 09:27 AM   #8
alejandroye
Member
 
Registered: May 2004
Location: SOUTH FLORIDA USA
Distribution: MANDRIVA / CENTOS
Posts: 146

Rep: Reputation: 15
Talking

hello

As you know I am and I am posting to see if you can help me

so, I have already the user "Aby" in the system but I want to add this user to apache group, or othe group that already exist in the system, what I have to do with adduser.

I am using drake 10.1

I know is easy question for you? but I feel confuse when I try man

thank you
 
Old 01-25-2005, 09:56 AM   #9
linuxLuser
Member
 
Registered: Jan 2005
Distribution: Gentoo
Posts: 111

Rep: Reputation: 16
The simplest thing you could do for adding a user is to get the superadduser program (if you have Gentoo like me...but since you don't...) or adduser. But to answer your question, first figure out what groups Aby belongs to:
Code:
cat /etc/group | grep Aby
The output might be something like this:
adm::4:root,adm,daemon,Aby
wheel::10:root,Aby
games::35:Aby

This means that Aby is in the adm, wheel, and games groups.

Now, on my box I have a command called "usermod" which will modify a user's account. I'll use this by typing in
Code:
usermod -G adm,wheel,games,new_group1,new_group2 Aby
This will add Aby to new_group1 and also to new_group2. If Aby is currently logged in, she won't be able to take advantage of the new groups until she logs out and then back in again (there are ways around this but that's just the simplest way). This includes if Aby is using the GUI.
And that's it. You must be careful to include the groups that Aby is already a part of in the command or Aby won't be a part of them anymomre. Don't just specify the new groups. Include every group that Aby needs to be a part of (hence why I checked before running "usermod").
I am using Gentoo and didn't know if Mandrake has the same command. But I happen to have a Mandrake 10 system on the same computer so I did a search and Mandrake does have the same command (in /usr/sbin/).
There may be other, better ways to do this, but this is how I do it because I only use two or three other users besides root.

- the dudeman

Last edited by linuxLuser; 01-25-2005 at 10:03 AM.
 
Old 01-25-2005, 10:01 AM   #10
bitfuzzy
Member
 
Registered: Nov 2003
Location: NY
Distribution: slackware
Posts: 357

Rep: Reputation: 98
usermod -G warning

[If the user is currently a member of a group which is
not listed, the user will be removed from the group]
 
  


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
useradd command question hct224 Linux - Newbie 2 06-14-2004 04:47 PM
Useradd command not found. keysorsoze Red Hat 8 05-01-2004 03:17 PM
useradd command johnpayback Linux - General 4 08-13-2002 05:24 PM
useradd command johnpayback Linux - Newbie 5 08-13-2002 10:22 AM
useradd command allancondino Linux - General 5 04-27-2002 12:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:58 AM.

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