summaryrefslogtreecommitdiff
path: root/runas
diff options
context:
space:
mode:
Diffstat (limited to 'runas')
-rwxr-xr-xrunas15
1 files changed, 6 insertions, 9 deletions
diff --git a/runas b/runas
index 5c18565..89f45c1 100755
--- a/runas
+++ b/runas
@@ -29,9 +29,7 @@ mkhandler() {
cat >$1 <<'EOF'
#!/usr/bin/env sh
cd /home/USERNAME
-cp /tmp/.Xauthority .
-shred -v /tmp/.Xauthority
-export DISPLAY=:0
+export DISPLAY=:0.0
# Graphical programme code after this line
EOF
}
@@ -45,13 +43,12 @@ if [ "$1" == "-n" ]; then
sed -i "s/USERNAME/$2/" /tmp/skel/.mkshrc /tmp/skel/$2
chmod 700 /tmp/skel/$2
$EDITOR /tmp/skel/$2
- sudo useradd -m -G audio -s /usr/bin/mksh -k /tmp/skel $2
- sudo passwd $2
+ sudo useradd -m -G audio,subject -s /usr/bin/mksh -k /tmp/skel $2
+ sudo passwd -l $2
else
cd $HOME
printf '\033k'"$1"'\033\\'
- cp .Xauthority /tmp
- chmod 606 /tmp/.Xauthority
- su -l $1 -c /home/$1/$1
- rm /tmp/.Xauthority
+ xhost +local:
+ sudo -u $1 -s /home/$1/$1
+ xhost -local:
fi;