3 # Script used for running executables with custom labels, as well as custom uid/gid
4 # Process label is changed by writing to /proc/self/attr/curent
6 # Script expects user id and group id to exist, and be the same.
9 # """By default, each user in Debian GNU/Linux is given a corresponding group
10 # with the same name. """
12 # Usage: root@desk:~# python notroot.py <uid> <label> <full_path_to_executable> [arguments ..]
13 # eg: python notroot.py 1000 User::Label /bin/ping -c 3 192.168.1.1
15 # Author: Alexandru Cornea <alexandru.cornea@intel.com>
20 uid = int(sys.argv[1])
24 open("/proc/self/attr/current", "w").write(label)
29 os.execv(path,sys.argv)