Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 1 | From 55a0adfc416ad85dbc440eaa667d98c200a8ce62 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jackie Huang <jackie.huang@windriver.com> |
| 3 | Date: Thu, 18 Dec 2014 17:23:37 +0800 |
| 4 | Subject: [PATCH] adduser: add -M option for useradd |
| 5 | |
| 6 | The useradd (from package passwd) in debian based system sets -M (--no-create-home) by default, |
| 7 | but the one we are using (from package shadow) sets -m (--create-home) by default, so we |
| 8 | need to explicitly add -M option for useradd call or it will try to create home twice and |
| 9 | throw a confused message: |
| 10 | "The home directory `/home/newuser' already exists. Not copying from `/etc/skel'" |
| 11 | |
| 12 | Upstream-Status: Submitted [1] |
| 13 | |
| 14 | [1] https://lists.alioth.debian.org/pipermail/adduser-devel/2016-October/005478.html |
| 15 | |
| 16 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> |
| 17 | --- |
| 18 | adduser | 4 ++-- |
| 19 | 1 file changed, 2 insertions(+), 2 deletions(-) |
| 20 | |
| 21 | diff --git a/adduser b/adduser |
| 22 | index a5f83f3..f6cb52c 100755 |
| 23 | --- a/adduser |
| 24 | +++ b/adduser |
| 25 | @@ -435,7 +435,7 @@ if ($action eq "addsysuser") { |
| 26 | $undouser = $new_name; |
| 27 | my $useradd = &which('useradd'); |
| 28 | &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s', |
| 29 | - $shell, '-u', $new_uid, $new_name); |
| 30 | + $shell, '-u', $new_uid, '-M', $new_name); |
| 31 | if(!$disabled_login) { |
| 32 | my $usermod = &which('usermod'); |
| 33 | &systemcall($usermod, '-p', '*', $new_name); |
| 34 | @@ -525,7 +525,7 @@ if ($action eq "adduser") { |
| 35 | $undouser = $new_name; |
| 36 | my $useradd = &which('useradd'); |
| 37 | &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s', |
| 38 | - $shell, '-u', $new_uid, $new_name); |
| 39 | + $shell, '-u', $new_uid, '-M', $new_name); |
| 40 | &invalidate_nscd(); |
| 41 | |
| 42 | create_homedir (1); # copy skeleton data |
| 43 | -- |
| 44 | 1.8.5.2 |
| 45 | |