Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-17-2011, 05:38 PM   #1
LQ Newbie
Registered: Jun 2010
Posts: 9

Rep: Reputation: Disabled
default directory for new user

I have created a Linux (openSUSE 11.2) fileserver and have successfully created 40 users who map to the Linux box for the purpose of backing up files on their Windows computers. The existing users all sync their files to /mnt/sync_data/home/username. The problem is that when I create new users their home directory (I hope I'm understanding this correctly)is: /home/username. I don't know how to redefine the home directory from /home/username to /mnt/sync_data/home/username.

Thank you

Last edited by willy_gn; 03-17-2011 at 05:39 PM. Reason: typo in subject line
Old 03-17-2011, 06:07 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
personally I'd suggest you shoudl leave the defaults as is and symlink (or potentially mount --bind) the location back to /home/ to preserve that location, as it's a standard, but you can change /etc/defaults/useradd if your distro uses it, to change the default home location. This will then affect ALL new users automatically. If you just want to do a one off, use the -m option to useradd, and to do it after the event use usermod, of just edit it directly in /etc/passwd.
Old 03-17-2011, 06:07 PM   #3
Senior Member
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
EDIT: beat to it with a better answer by acid_kewpie.

man useradd
-b, --base-dir BASE_DIR
The default base directory for the system if -d HOME_DIR is not
specified. BASE_DIR is concatenated with the account name to
define the home directory. If the -m option is not used, BASE_DIR
must exist.

If this option is not specified, useradd will use the base
directory specified by the HOME variable in /etc/default/useradd,
or /home by default.
So edit
HOME variable in /etc/default/useradd

Last edited by andrewthomas; 03-17-2011 at 06:09 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Default user name and password cyrix_j Linux - General 6 06-13-2010 11:27 AM
Create user add file with default password and force user to change it? Morgandy Linux - Newbie 3 02-02-2010 06:06 PM
Default user group mrtedweb Linux - Newbie 3 08-23-2009 01:37 PM
MySQL in F3 default user? CrazyPilot Fedora 2 03-05-2005 03:51 PM
default user options? hux Linux - Security 2 12-18-2002 11:19 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:52 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration