posix - Can I assume that nobody is 65534? -


i'm writing setuid root program. program needs open file writing , write content. needs euid 0 opening file, can drop privileges.

to drop privileges, seteuid current uid. thinking @ switching nobody:nogroup.

now, wondering: can assume nobody 65534 on every system (and nogroup 65534 too)? defined standard (posix, maybe)?

you can't. nobody has had @ least few different ids across distros , time:

historically, user “nobody” assigned uid -2 several operating systems, although other values such 2^(15)−1 = 32,767 in use, such openbsd. compatibility between 16-bit , 32-bit uids, many linux distributions set 2^(16)−2 = 65,534; linux kernel defaults returning value when 32-bit uid not fit return value of 16-bit system calls. alternative convention assigns last uid of range statically allocated system use (0-99) nobody: 99.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -