server - Allow user in a chrooted shell to use a sudo command - Ask Ubuntu


i have user chrooted directory, , working smoothly. want group user in able restart single process that's being managed supervisor, however, , can't figure out how.

i've added line /etc/sudoers:

%mygroupname = (root) nopasswd:/usr/bin/supervisorctl restart myprocessname 

i copied /usr/bin/sudo same path in chroot environment. copied of dependencies relevant places (found using ldd /usr/bin/sudo).

i've gathered sudo uses ton of additional files on system, , i've copied them chroot environment. i'm stuck now, however, , can't past error. missing?

sudo log (line breaks readability):

nov 10 20:29:04 sudo[3593] pam_setcred: failure setting user credentials @                            sudo_pam_begin_session()                            /build/sudo-1bdjzq/sudo-1.8.16/plugins/sudoers/auth/pam.c:274  nov 10 20:29:04 sudo[3593] pam_open_session: module unknown @                            sudo_pam_begin_session()                            /build/sudo-1bdjzq/sudo-1.8.16/plugins/sudoers/auth/pam.c:283 

is stupid idea in first place?

rather trying copy sudo binary , dependencies chroot, might easier have script running root checks when file exists , restarts process.

that script might this:

#!/bin/bash restartfile="restartprocess" while :    user in /home/*          if [ -f $user/$restartfile ]                supervisorctl restart myprocessname          rm $user/$restartfile       fi    done    sleep 5 #adjust file checking time interval done 

(this assumes user chrooted folder in /home)

once script running root, chrooted user have run 1 of following commands create empty file (called restartprocess) in home directory (you add ~/ before file name):

touch restartprocess 
echo > restartprocess 
> restartprocess 

and process restarted.


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User