DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
According to the man pages for login.defs and useradd, CREATE_HOME should make useradd create the home directory. What am I missing?
That "CREATE_HOME" does not apply to system users:
Code:
-m, --create-home
Create the user's home directory if it does not exist. The files and
directories contained in the skeleton directory (which can be defined with the
-k option) will be copied to the home directory.
By default, if this option is not specified and CREATE_HOME is not enabled, no
home directories are created.
(and further on)
CREATE_HOME (boolean)
Indicate if a home directory should be created by default for new users.
This setting does not apply to system users, and can be overridden on the
command line.
So best use the option -m to create home dirs (and make sure your /etc/default/useradd file has been created and filled with the right values for all you do not give on the commandline). For instance
Code:
HOME=/home
makes sure that that home dir will be created below /home, which otherwise is NOT the default, it is created as a subdir to the current one.
That "CREATE_HOME" does not apply to system users:
I know, but this is not a system user. The values in the defaults file have their own defaults, such as HOME's default is /home:
Code:
man useradd
...
-b, --base-dir BASE_DIR
...
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.
Last edited by berndbausch; 01-20-2020 at 12:57 AM.
However on Debian you should probably use adduser, not useradd.
adduser is a script over useradd, it asks for all of the values for the pasword file and then issues an useradd command with all values given, so it doesn't rely on /etc/default/useradd nor /etc/login.defs, everything is given through useradd command line options (except the password, for which passwd is called directly).
Quote:
$ file /usr/sbin/adduser
/usr/sbin/adduser: Bourne-Again shell script, ASCII text executable
It's also a script that calls useradd in Debian but it's in written in perl and gets the config from /etc/adduser.conf
Evo2.
Quote:
Originally Posted by ehartman
adduser is a script over useradd, it asks for all of the values for the pasword file and then issues an useradd command with all values given, so it doesn't rely on /etc/default/useradd nor /etc/login.defs, everything is given through useradd command line options (except the password, for which passwd is called directly).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.