Changes

Jump to navigation Jump to search
Line 57: Line 57:     
   groupadd -g 64002 sugar
 
   groupadd -g 64002 sugar
   useradd -m -u 64002 -g sugar sugar
+
   useradd -m -u 64002 -g sugar -s /bin/bash sugar
    
Then, inside the chroot, you can happily run sugar as user 'sugar' with something like
 
Then, inside the chroot, you can happily run sugar as user 'sugar' with something like
   −
cat > as_person <<EOF
+
  su sugar -
#!/usr/bin/env python
+
  export DISPLAY=:1
from os import environ, chdir, setgroups, setgid, setuid, execve
+
  export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --print-address --fork)
from sys import argv
+
  sugar
from pwd import getpwnam
  −
user = getpwnam(argv[1])
  −
environ['HOME'] = user.pw_dir
  −
environ['USER'] = user.pw_name
  −
chdir(user.pw_dir)
  −
setgroups([user.pw_gid])
  −
setgid(user.pw_gid)
  −
setuid(user.pw_uid)
  −
execve(argv[2], argv[2:], environ)
  −
EOF
  −
chmod a+x as_person
  −
./as_person sugar /usr/bin/sugar
  −
 
      
== Jhbuild ==
 
== Jhbuild ==
76

edits

Navigation menu