Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I'd like to use the adduser command to add a user (with disabled password) via a shell script.

By default, adduser prompts you for various values (e.g., Full Name). Is there any way to submit these values via command line? Or will I need to useradd instead?

share|improve this question
have a look at the man page for adduser. It will help you out. –  Zoke Jan 9 '12 at 14:01
@Zoke I couldn't find the info I was looking for on the man page. –  Lorin Hochstein Jan 9 '12 at 14:06

1 Answer 1

up vote 77 down vote accepted

Use the --gecos option to skip the chfn interactive part.

adduser --disabled-password --gecos "" username

It's all in the man page. Not the most obvious formulation tho.

--gecos GECOS
          Set  the  gecos field for the new entry generated.  adduser will
          not ask for finger information if this option is given.

The GECOS field is a comma separated list as such: Full name,Room number,Work phone,Home phone

Hope this helps you.

share|improve this answer
Yeah, I can see how I missed that. "gecos" is not an obvious description –  Lorin Hochstein Jan 9 '12 at 14:26

Your Answer


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.