Add option to not use user's shell

This commit is contained in:
Jamie Cameron
2020-04-05 17:30:32 -07:00
parent 6deecd2b48
commit 07e3a262e1
4 changed files with 10 additions and 1 deletions

View File

@@ -9,6 +9,9 @@ print &ui_table_row($text{'acl_user'},
&ui_opt_textbox("user", $_[0]->{'user'}, 20, $text{'acl_user_def'})." ".
&user_chooser_button("user"));
print &ui_table_row($text{'acl_shellenv'},
&ui_yesno_radio("shellenv", $_[0]->{'shellenv'}));
print &ui_table_row($text{'acl_chroot'},
&ui_filebox("chroot", $_[0]->{'chroot'}, 30, 0, 0, undef, 1));
}
@@ -19,5 +22,6 @@ sub acl_security_save
{
$_[0]->{'user'} = $in{'user_def'} ? undef : $in{'user'};
$_[0]->{'chroot'} = $in{'chroot'};
$_[0]->{'shellenv'} = $in{'shellenv'};
}

View File

@@ -1,2 +1,3 @@
user=root
chroot=/
shellenv=1

View File

@@ -85,7 +85,9 @@ if (!$in{'clear'}) {
# programs get the right
# module, not this one!
if (&supports_users() && $user ne "root") {
$cmd = &command_as_user($user, 2, "cd $pwd ; $cmd");
$cmd = &command_as_user(
$user, $access{'shellenv'} ? 2 : 0,
"cd $pwd && $cmd");
@uinfo = getpwnam($user);
}
else {

View File

@@ -11,6 +11,8 @@ index_timedout=Command was terminated after running for $1 seconds.
acl_user=Execute commands as user
acl_user_def=Current Webmin user
acl_shellenv=Use selected user's environment?
acl_chroot=Chroot to directory
log_run=Ran command $1
log_clear=Cleared command history