summaryrefslogtreecommitdiff
path: root/runas
diff options
context:
space:
mode:
authorTslil Clingman <tslil.clingman@gmail.com>2015-11-29 18:29:43 -0500
committerTslil Clingman <tslil.clingman@gmail.com>2015-11-29 18:29:43 -0500
commit42ee791b2f58cc8fa78b73d058ecba0f0b091798 (patch)
tree8ee47032e77a43c3c309ea436f471405d89faba6 /runas
parent0cbf949afa7bdb502dacb377c70b77af3b598416 (diff)
Switched to using sudo, groups, xhost over .Xauthority and su
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;