Yet another attempt to run upstart jobs as unprivileged user

This commit is contained in:
Duncan Sommerville 2015-01-12 09:48:08 -05:00
parent 24123ef45d
commit bf1355a203
8 changed files with 15 additions and 49 deletions

View file

@ -1,22 +0,0 @@
start on runlevel [2345]
stop on runlevel [!2345]
task
env user=WEB_USER
export user
script
uid=$(getent passwd "$user"|cut -d: -f3)
gid=$(getent passwd "$user"|cut -d: -f4)
# Create directory that would normally be
# created by PAM when a user logs in.
export XDG_RUNTIME_DIR="/run/user/$uid"
mkdir -p "$XDG_RUNTIME_DIR"
chmod 0700 "$XDG_RUNTIME_DIR"
chown "$uid:$gid" "$XDG_RUNTIME_DIR"
start airtime-session-init user="$user"
end script

View file

@ -1,15 +0,0 @@
instance $user
stop on runlevel [016]
script
uid=$(getent passwd "$user"|cut -d: -f3)
HOME=$(getent passwd "$user"|cut -d: -f6)
export XDG_RUNTIME_DIR="/run/user/$uid"
export HOME
echo $HOME
exec su -s /bin/sh -c 'exec "$0" "$@"' $user -- init --user --confdir /usr/share/upstart/sessions/
end script