-   Linux - Newbie (
-   -   A question about add new user to a group (

thomas2004ch 09-07-2009 04:35 AM

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 ?

druuna 09-07-2009 04:41 AM

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.

thomas2004ch 09-07-2009 04:59 AM


pwc101 09-07-2009 05:01 AM

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.

thomas2004ch 09-07-2009 05:44 AM

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.

tredegar 09-07-2009 01:06 PM


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 :)

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