Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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