Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

Change default home directory for new users in Linux

$
0
0

I have a requirement to create new user home directories in a sub-directory of the username in a different base directory to the norm. The required location is /users/{user}/home. Currently, when a new user is created, it is manually moved from the default to the required directory.

I can change the base directory in /etc/default/useradd, but here you are unable to specify {user} as a variable. The man page for changing the defaults of useradd states

The user's name will be affixed to the end of BASE_DIR to form the new user's home directory name ...
  • Is it possible to do this with the useradd file, perhaps some hidden trick?
  • Is this "acceptable"? (ie should I force a change to an established system to bring it in line?)

(I am aware I can put some commands into /usr/local/sbin/adduser.local to move the home directory after creation. Is this the only/proper way to do this?)


Viewing all articles
Browse latest Browse all 5049

Trending Articles