11

I have been trying to add a new user. I typed in adduser then username and also tried useradd then username. It does seem to add a user, but when I login I only get a dollar sign instead of user@servername. I have tried adding rules to allow me into the sudo for that username, but why do I only get the dollar sign?

  • The $ indicates the plain old shell. Do sudo usermod --shell /usr/bin USERNAME and replace "USERNAME" with the name of the user. – Thomas Ward Oct 28 '13 at 18:03
  • Or create user "testuser" with sudo privileges one-liner: useradd testuser -G sudo -d /home/testuser -s /bin/bash -m -c "Test User" && echo testuser:P4s5W0rD | chpasswd && sed -ri 's/^# (%sudo.+ALL=(ALL).+NOPASSWD: ALL)/\1/' /etc/sudoers –  May 28 '14 at 09:02

2 Answers2

15

You might have either accidentally used "useradd" instead of "adduser" - which adds the user, but does not set up a profile for him/her - or you might be missing the "skeleton" files in /etc/skel which normally set up a default user account.

Please do sudo userdel username (where username is the name of the account you're creating), then sudo adduser username and post the output here. You SHOULD get something like the following:

me@banshee:~$ sudo adduser noob
Adding user `noob' ...
Adding new group `noob' (1005) ...
Adding new user `noob' (1005) with group `noob' ...
Creating home directory `/home/noob' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
Changing the user information for noob
Enter the new value, or press ENTER for the default
    Full Name []: 
    Room Number []: 
    Work Phone []: 
    Home Phone []: 
    Other []: 
Is the information correct? [Y/n] 

If you do all that and the user still does not get a full prompt, then you're missing some files from /etc/skel - please post back, and we can help further. I think you just accidentally used useradd instead of adduser, though, which does not do ANY of the above stuff - it just creates a system account and that's it, no homedir, no nothing.

Jim Salter
  • 4,343
6

Well, I don't know what's the default behaviour for adduser but I think you should specify the options explicity. Like:

sudo useradd -d /home/testuser -m testuser

the command above set the home directory for the new user and create it (-m) if necessary. Then you need to set the password for the new user:

sudo passwd testuser

There are also several other options, check the man page to see them:

man adduser