I need to set my process to run under ‘nobody’, I’ve found os.setuid(), but how do I find uid if I have login?
I’ve found out that uids are in /etc/passwd, but maybe there is a more pythonic way than scanning /etc/passwd. Anybody?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You might want to have a look at the pwd module in the python stdlib, for example:
it uses /etc/passwd (well, technically it uses the posix C API, so I suppose it might work on an OS if it didn’t use /etc/passwd but exposed the needed functions) but is cleaner than parsing it manually