Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stupid useradd question

Status
Not open for further replies.

paladin256

Technical User
Apr 16, 2002
189
US
How do I add a description to the username when I create the account?
Right now I do useradd -m to get the following:
gwynn:x:1132:1::/home/gwynn:/bin/false.
What I would like to do is have the following included in : gwynn:x:1132:1:Gwynn Dail up Account for remote access:/home/gwynn:/bin/false so I can keep track of what the accounts are used for.
How do I add the comments in when I create the account?
 
The -c option allows you to add a comment to the user account. You can also use -c to add a comment to an account when you use the usermod command.

Or you could carefully edit the /etc/passwd file to add a comment.
 
How do I use the -c option. I tried useradd -m test1 -c test account, but that did not work. I also tried varients of that -mc -m -c etc. Could you provide an example?
 
It isn't as easy as the man page made it appear to be. I've been trying to get it to work ever since I posted my original answer!

Here is an example:

useradd -u 275 -g dba -G staff -m -s /bin/ksh -c "testing 2" testy2

This adds a user with a uid of 275, primary group of dba, secondary group of staff. The -m says to make the home directory in the default path (usually /export/home), -s specifies the shell for the user. The -c you can see has to have quotes around it if there are any spaces in the comment, and finally, the login name.
 
Thanks. My mistake was I was trying to do user first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top