Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 4 down vote accepted

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
share|improve this answer
    
Precisely what I needed. Thanks! – sri Nov 11 '11 at 7:37

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .