実行時環境:
Mac OS X 10.8.3 インテル 64 ビット
パイソン 2.7.3
setuid nobody の長さの問題を解決するには?
バッシュ
$ id nobody
uid=4294967294(nobody) gid=4294967294(nobody) groups=4294967294(nobody),12(everyone),61(localaccounts)
$ cat /etc/password
nobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false
パイソン
>>> import pwd
>>> import os
>>> uid = pwd.getpwnam('nobody')
>>> uid
pwd.struct_passwd(pw_name='nobody', pw_passwd='*', pw_uid=4294967294, pw_gid=4294967294, pw_gecos='Unprivileged User', pw_dir='/var/empty', pw_shell='/usr/bin/false')
>>> uid = pwd.getpwnam('nobody')[2]
>>> uid
4294967294
>>> os.setuid(uid)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: user id too big