description "My PowerOn Script" author "xxx" stop on stopping xsession console none nice 2 exec /usr/bin/aegis-exec -s -u user /bin/sh -c "python /home/user/bin/poweron.py"
exec /usr/bin/aegis-exec -s -u user -l /home/user/bin/poweron.py
/home/user/bin # id uid=0(root) gid=0(root) groups=0(root),4(adm),20(dialout),44(video),670(pulse-access) /home/user/bin # chmod +s poweron.py chmod: poweron.py: Operation not permitted /home/user/bin # exit ~/bin $ id uid=29999(user) gid=30024(developer) groups=0(root),20(dialout),44(video),670(pulse-access),29999(users),30011(metadata-users),30014(calendar),30023(gallerycoredata-users),9990210,9990252,9990253,9990254,9990255,9990256,9990288,9990289,9990349,9990402,9990403,9990430,9990588 ~/bin $ chmod +s poweron.py ~/bin $ ls -l poweron.py -rwsr-sr-x 1 user develope 2548 Apr 23 08:36 poweron.py
~ # python Python 2.6.6 (r266:84292, Mar 11 2011, 01:19:30) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pwd, grp, os >>> os.getuid() 0 >>> uid = pwd.getpwnam('user').pw_uid >>> uid 29999 >>> os.setuid(uid) Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: [Errno 1] Operation not permitted
/etc/init/apps # ps afx | grep power 2708 nobody /bin/sh -c python /home/user/bin/poweron.py 2710 nobody python /home/user/bin/poweron.py 2916 root grep power /etc/init/apps # kill 2708 2710 sh: can't kill pid 2708: Operation not permitted sh: can't kill pid 2710: Operation not permitted /etc/init/apps # kill -9 2708 2710 sh: can't kill pid 2708: Operation not permitted sh: can't kill pid 2710: Operation not permitted /etc/init/apps # id uid=0(root) gid=0(root) groups=0(root),4(adm),20(dialout),44(video),670(pulse-access) /etc/init/apps # devel-su nobody su: can't chdir to home directory '/nonexistent' BusyBox v1.20.0.git (MeeGo 3:1.20-0.2+0m8) built-in shell (ash) Enter 'help' for a list of built-in commands. / $ kill 2708 2710 / $
~ # devel-su --help Usage: su [OPTIONS] [-] [USER]
exec devel-su -c "python /home/user/bin/poweron.py" - user