aboutsummaryrefslogtreecommitdiffstats
path: root/iurt_root_command
diff options
context:
space:
mode:
authorOlivier Blin <blino@mageia.org>2010-11-01 23:24:36 +0000
committerOlivier Blin <blino@mageia.org>2010-11-01 23:24:36 +0000
commit3028dd876e14b25242185b8cca4122bd83cc5d1f (patch)
treef6b9c1dda2b0a6a09822fe3632905ae954d12518 /iurt_root_command
parent363b9c4f4d4a142433bc9d66ab51df173bf48ae9 (diff)
downloadiurt-3028dd876e14b25242185b8cca4122bd83cc5d1f.tar
iurt-3028dd876e14b25242185b8cca4122bd83cc5d1f.tar.gz
iurt-3028dd876e14b25242185b8cca4122bd83cc5d1f.tar.bz2
iurt-3028dd876e14b25242185b8cca4122bd83cc5d1f.tar.xz
iurt-3028dd876e14b25242185b8cca4122bd83cc5d1f.zip
use iurt_root_command to add user
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);
+}