LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   default directory for new user (https://www.linuxquestions.org/questions/linux-newbie-8/default-directory-for-new-user-869271/)

willy_gn 03-17-2011 04:38 PM

default directory for new user
 
Hello,
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

acid_kewpie 03-17-2011 05:07 PM

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.

andrewthomas 03-17-2011 05:07 PM

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

From
Code:

man useradd
Quote:

-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
Code:

HOME variable in /etc/default/useradd


All times are GMT -5. The time now is 01:32 PM.