We are running an Ubuntu server and have several people in the company that need to have SSH access. This is a web server and the different sites reside in /home. When I create a new user on the server with adduser "username" then a new directory is automatically created in /home. As the sites also reside here, I'd like to re-structure this and actually create /home/users/ and manage all user-directories from there. However, with adduser I can not set the home directory, and I can not find a way to change this easily.

If I use useradd and the -m option, I can specify the home directory. However, my bash is different. It only shows "$" instead of the server name and current directory, as is default (user@server:/home/). Also, tabbing to get the full filename does not work anymore. This should have to do with bash settings, but I can not get this to work.

So, the question is:

  • Is there an easy way to change the home directory when using adduser? OR:
  • How can the bash configuration be fixed when using useradd?

Note: I compared .bashrc and .profile for the new user with useradd and adduser, and they are identical.

  • You may be getting /bin/sh for the user's login shell which doesn't have tab completion and has a much simpler prompting capability. – Dennis Williamson Nov 29 '10 at 1:11

If you look at the adduser man page you will see that there is a -d or --home command line option which allows you to specify a users home directory.

  • Excellent, thanks! This was extremely simple and I have no idea how I did not find this before. If somebody knows what happens to bash when you use useradd I am still interested, but at least the user adding problem is solved! – user60129 Nov 28 '10 at 23:46
  • In Red Hat / Fedora land, you can set HOME in /etc/default/useradd to change the default. Not sure if that's the same in Ubuntu. – mattdm Nov 28 '10 at 23:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy