wonder95
wonder95

Reputation: 4285

Unable to create user on Ubuntu on Amazon EC2

I have an Amazon EC2 instance running Ubuntu 12.04, and for some reason I am unable to create a new user when logged in as either the default ubuntu user or root. When I do "useradd myusername", I get no prompts like I usually do (the stupid ones like phone number, room number, etc.). At the same time, no home directory is created, nor do any of the other things normally take place when an account is created. However, if I try to add the name again, it tells me that the account already exists, and if I do "userdel myusername", it acts like something is deleted (i.e. no error message). I've never seen this on on Ubuntu server before.

Is this something typical with Ubuntu on EC2? Am I doing something wrong? Anyone know why an account isn't being created?

Thanks.

Upvotes: 1

Views: 368

Answers (1)

ianjs
ianjs

Reputation: 827

You are probably thinking of adduser which has interactive prompts for most of the fields. See this question.

useradd and userdel are for creating accounts in scripts where you don't want to be prompted. By default they will only create the user and requires additional command line options to create the home directory etc.

You will find it did create the account (look in /etc/passwd) and the complaint about "already exists" confirms this.

How do you remember the difference? No idea. Seems to be one of those historical things you just need to know.

Upvotes: 1

Related Questions