useradd --help -d, --home-dir HOME_DIR home directory for the new user account -M, do not create user's home directory yet useradd -M -s /sbin/nologin FRED produces in /etc/passwd fred:x:504:504::/home/fred:/sbin/nologin Trying again with useradd -d /dev/null -s /sbin/nologin doris gives a CLI message useradd: warning: the home directory already exists. Not copying any file from skel directory into it. and in /etc/password doris:x:505:505::/dev/null:/sbin/nologin QUESTION What is the 'official' method of creating a user with no home directory and no log-on ability ? Thank you. -- Paul. England, EU. Je suis Charlie.
On 25.01.2015 04:30, Always Learning wrote:> > useradd --help > > -d, --home-dir HOME_DIR home directory for the new user account > -M, do not create user's home directory > yet > useradd -M -s /sbin/nologin FRED > > produces in /etc/passwd > > fred:x:504:504::/home/fred:/sbin/nologin > > Trying again with > > useradd -d /dev/null -s /sbin/nologin doris > > gives a CLI message > > useradd: warning: the home directory already exists. > Not copying any file from skel directory into it. > > and in /etc/password > > doris:x:505:505::/dev/null:/sbin/nologin > > QUESTION > > What is the 'official' method of creating a user with no home directory > and no log-on ability ?Your first invocation seemed to look fine. What result do you expect to get? Every user needs a home directory in /etc/passwd even if it doesn't exist. Regards, Dennis
On Sun, 2015-01-25 at 04:38 +0100, Dennis Jacobfeuerborn wrote:> On 25.01.2015 04:30, Always Learning wrote: > > > > useradd --help > > > > -d, --home-dir HOME_DIR home directory for the new user account > > -M, do not create user's home directory > > yet > > useradd -M -s /sbin/nologin FRED > > > > produces in /etc/passwd > > > > fred:x:504:504::/home/fred:/sbin/nologin > > > > Trying again with > > > > useradd -d /dev/null -s /sbin/nologin doris > > > > gives a CLI message > > > > useradd: warning: the home directory already exists. > > Not copying any file from skel directory into it. > > > > and in /etc/password > > > > doris:x:505:505::/dev/null:/sbin/nologin > > > > QUESTION > > > > What is the 'official' method of creating a user with no home directory > > and no log-on ability ? > > Your first invocation seemed to look fine. What result do you expect to > get? Every user needs a home directory in /etc/passwd even if it doesn't > exist.Guten Morgen Denis, Aber/But ..... -M, do not create user's home directory so why do I see in /etc/passwd fred:x:504:504::/home/fred:/sbin/nologin Should the 'correct' entry be:- fred:x:504:504:::/sbin/nologin ? OK, I can use -d /nix but what should -M actually do ? -- Regards, Paul. England, EU. Je suis Charlie.