I need to use adduser to add a user from the command line. Currently, I am doing

sudo adduser -g someGroup -c "John Doe" dojohn 

but I'd like to have the command also include a "Work Phone number" like 777 222 1342. I'm sure it has something to do with adduser.conf, but have not been able to find more information about it online.

If relevant:
OS: Ubuntu Linux, Shell: bash
User: John Doe, username: dojohn, Work Phone Number: 777 222 1342

link|improve this question

75% accept rate
feedback

2 Answers

The comment field in linux is traditionally split like this:

real name,room number,work phone,home phone,other

So you can populate these with the -c command:

sudo adduser -g someGroup -c "John Doe,,777 222 1342" dojohn
link|improve this answer
Precisely what I needed. Thanks! – sri Nov 11 '11 at 7:37
feedback

There is no field in the passwd or shadow authdbs for anything other than the "comment" provided with -c, and there is no way for useradd to provide additional information for an authdb that does have such a field (e.g. LDAP). You will need to use both a different authdb and a different tool in order to provide such information in a meaningful manner.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.