aboutsummaryrefslogtreecommitdiffstats
path: root/iurt_root_command
diff options
context:
space:
mode:
Diffstat (limited to 'iurt_root_command')
-rwxr-xr-xiurt_root_command9
1 files changed, 9 insertions, 0 deletions
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, "<directory>]",
"umount the given directory",
\&umount, "Unmounting" ],
+ [ "", "useradd", 3, "<directory> <username> [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);
+}