I am trying to change to default Home directories when creating new users with no success. I've tried the ect/default/useradd file as well as looking in the smb.conf file witch says that another script file called /usr/sbin/useradd is controling it. I do not know enough about the useradd script to change it to get the results I'm looking for. I want to make the default home diretories /media/Raid1/home instead of /home so that all new users will have thier home directories created in subs of that dirertory named after the user. Can any one help?


Eric (tssgery)'s picture

I have two suggestions for you

  • The useradd script accepts an arugment, -d <dir> I believe, that allows you to specify the home directory for the user. Useing that the syntax would be something like:
  • create a symlink from /media/Raid1/home to /home. In this manner, any scripts/tools that assume /home is the home directory will still work.

I would probably go the symlink route

Jeremy Davis's picture

So not sure why it's not working for you. Perhaps try searching/posting in the Ubuntu forums. Perhaps this is an Ubuntu 10.04 (basis of TKL v11.x) idiosyncracy

In the meantime you can use the -d switch to define the user home directory when using useradd. eg

useradd -d /media/Raid1/home/newuser -m newuser

(the -m switch creates the directory).

You can also do this in Webmin: System >> Users & Groups >> Create new user and set the directory.

Obviously this doesn't help you re your query on how to make it the default location but it will get you going.

Also (as you may already be aware) to use the new user 'newuser' with Samba you will need to sync Linux users and Samba users (Samab maintains its own user database).

Add new comment