TurnKey Linux Virtual Appliance Library

Changing Default Home Directories in Fileserver Appliance

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?

Thanks

Eric (tssgery)'s picture

two suggestions

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's picture

AFAIK editing /etc/default/useradd should do it

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).

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)