Share your knowledge at the LQ Wiki.
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 09-07-2009, 04:35 AM   #1
Registered: Aug 2009
Posts: 537

Rep: Reputation: 33
A question about add new user to a group

I added a user 'apache2' to an existed group 'www' with
useradd -g www apache2
Then I use cat /etc/passwd to list the user and I got:
But the directory /hoe/apache2 is not there. Should I create this dir with mkdir /home/apache2 ?
Old 09-07-2009, 04:41 AM   #2
LQ Veteran
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400Reputation: 2400
You should read the useradd / groupadd / usermod / userdel manpages......

To create a new user:

useradd -c "comment goes here" -d /homedir/location -m -g www -s /bin/bash apache2

The -m and -d go together (-d sets the homedir, -m creates it if it does not exist).

Hope this helps.

Last edited by druuna; 09-07-2009 at 06:43 AM. Reason: Added userdel for completeness
Old 09-07-2009, 04:59 AM   #3
Registered: Aug 2009
Posts: 537

Original Poster
Rep: Reputation: 33

Last edited by thomas2004ch; 09-07-2009 at 05:01 AM.
Old 09-07-2009, 05:01 AM   #4
Senior Member
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
Have a look at the userdel command.

Edit: ok. OP deleted the question which was "How can I delete the user now? I want to create it again with the command you mentioned". Which is why my response seems slightly disjointed.

Last edited by pwc101; 09-07-2009 at 05:03 AM. Reason: OP removed question from post above.
Old 09-07-2009, 05:44 AM   #5
Registered: Aug 2009
Posts: 537

Original Poster
Rep: Reputation: 33
Sorry, right after I asked how to delete the user I find how to do that. So I delete my question. aybe in the same time you answered my question.
Old 09-07-2009, 01:06 PM   #6
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Debian "Testing"
Posts: 6,117

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
So I delete my question.
Please don't do that again - because it makes these threads messy and difficult to follow.

You can of course go back to your post and add [EDIT] I solved this bit [/EDIT]
There's also a "Reason for this edit" box when you make an edit.

Bottom line: Please don't delete, just add an explanation.

Thanks, and pleased your problem is solved


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
How to list user in Linux box, add an user to a group! steady_lfcfan Linux - Newbie 12 01-27-2013 01:14 PM
how to add a user to a new group? emanresu Linux - Newbie 5 11-21-2005 08:18 AM
add user to the group ashley75 Linux - General 4 03-30-2005 02:42 PM
add user to group brandnewbie Linux - Newbie 3 08-08-2004 04:53 PM
how do i add user to a group jogurt666 Linux - General 2 04-02-2004 10:05 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:29 AM.

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
Open Source Consulting | Domain Registration