Adding new Ubuntu users and mapping network drives with Samba

Sometimes you can forget the odd flag on a bash command and it can really confuse matters!

I added a new user, but couldn’t get bash, and instead got /bin/sh upon login. The home directory hadn’t been created, so I had to do that too, and then I had issues trying to get our Windows workstations to map a network drive to the linux account.

To save anyone else the grief, here’s how it should be done:

useradd -m -s /bin/bash delboy admin
passwd delboy
smbpasswd delboy

By adding admin to the end of the useradd command, the user is allowed to run sudo. You can omit this, and if you need to add him later yyou can edit /etc/sudoers

If you screw up and need to remove the user AND his home directory, enter the following:

userdel -r delboy

If you have an already existing user and get the error message

"Failed to find entry for user delboy."

Then run the command with the -a flag:

smbpasswd -a delboy
Advertisements