From 3028dd876e14b25242185b8cca4122bd83cc5d1f Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 1 Nov 2010 23:24:36 +0000 Subject: use iurt_root_command to add user --- iurt_root_command | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'iurt_root_command') diff --git a/iurt_root_command b/iurt_root_command index 05b6cdc..d9d20fa 100755 --- a/iurt_root_command +++ b/iurt_root_command @@ -138,6 +138,9 @@ $run{todo} = []; [ "", "umount", 1, "]", "umount the given directory", \&umount, "Unmounting" ], + [ "", "useradd", 3, " [uid]", + "Add user in given chroot", + \&useradd, "Useradd" ], ); open(my $LOG, ">&STDERR"); @@ -361,3 +364,9 @@ sub umount { check_path_authorized($dir) or return; return !system("umount", $dir); } + +sub useradd { + my ($_run, $dir, $username, $o_uid) = @_; + check_path_authorized($dir) or return; + return !system('chroot', $dir, 'useradd', if_($o_uid, '-o', '--uid', $o_uid), $username); +} -- cgit v1.2.1