useradd: invalid option -- 'n'

0

I'm trying to create new user with default values, but it gives me error that such option is invalid. So does something changed and I need to use something else to create user with default values?

 sudo useradd -n user 

useradd: invalid option -- 'n'

I'm using ubuntu 14.04.

Andrius

Posted 2014-09-08T12:58:13.880

Reputation: 477

Answers

0

You get the error because -n does not exist as an option (according to my useradd manpage).

It is not clear what you mean by default falues but the most straighforward way to create a user and place him into the users group would be

useradd -g users <username>

The user needs to be part of at least one group... which in this case is users (initial group).

With options like -m you can create a home-directory for that user along the way.

ap0

Posted 2014-09-08T12:58:13.880

Reputation: 1 180

I solved this with adduser command, that helped craeting user interactively. Using useradd always created user with some strange options. Like you couldn't even use cd and I guess shell default profile was not used so it looked strange. But with adduser it creates user with all default options my first linux user gets (except access rights of course) – Andrius – 2014-09-08T13:20:42.090