LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 09-07-2009, 05:35 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

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


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

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
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 07:43 AM. Reason: Added userdel for completeness
 
Old 09-07-2009, 05:59 AM   #3
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

Original Poster
Rep: Reputation: 32
thanks.

Last edited by thomas2004ch; 09-07-2009 at 06:01 AM.
 
Old 09-07-2009, 06:01 AM   #4
pwc101
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 06:03 AM. Reason: OP removed question from post above.
 
Old 09-07-2009, 06:44 AM   #5
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

Original Poster
Rep: Reputation: 32
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, 02:06 PM   #6
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Debian "Jessie"
Posts: 6,085

Rep: Reputation: 398Reputation: 398Reputation: 398Reputation: 398
Quote:
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
 
  


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


All times are GMT -5. The time now is 06:51 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration