[Adduser-devel] [PATCH] adduser: add -M option for useradd

jackie.huang at windriver.com jackie.huang at windriver.com
Wed Oct 19 03:03:07 UTC 2016


From: Jackie Huang <jackie.huang at windriver.com>

The -M (--no-create-home) option is set for useradd
by default on debian based system, but it's not on
other system like Yocto, add -M option always so
it works the same when porting to other systems.

Signed-off-by: Jackie Huang <jackie.huang at windriver.com>
---
 adduser | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/adduser b/adduser
index a5f83f3..96f083b 100755
--- a/adduser
+++ b/adduser
@@ -435,7 +435,7 @@ if ($action eq "addsysuser") {
     $undouser = $new_name;
     my $useradd = &which('useradd');
     &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
-		$shell, '-u', $new_uid, $new_name);
+		$shell, '-u', $new_uid, '-M', $new_name);
     if(!$disabled_login) {
         my $usermod = &which('usermod');
         &systemcall($usermod, '-p', '*', $new_name);
@@ -526,6 +526,7 @@ if ($action eq "adduser") {
     my $useradd = &which('useradd');
     &systemcall($useradd, '-d', $home_dir, '-g', $ingroup_name, '-s',
 		$shell, '-u', $new_uid, $new_name);
+		$shell, '-u', $new_uid, '-M', $new_name);
     &invalidate_nscd();
 
     create_homedir (1); # copy skeleton data
-- 
2.8.3




More information about the Adduser-devel mailing list