473,324 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Dropping privileges in python daemon

I'm currently working on a python daemon which needs to be able to
correctly drop privileges after opening ports and files that it needs to
open as root.

I'm used from C programming to use setresuid() to change the real,
effective and saved uid in one go, and although the os module has some of
the set*uid() functions it doesn't seem to have setresuid().

Nor could I find any another functions in os.* or posix.* which manipulate
the saved uid...so how do I get/set the saved uid in python?

(please CC me any replies)

--
David Härdeman

Aug 18 '08 #1
1 2013
Am Mon, 18 Aug 2008 14:33:27 +0200 schrieb David Härdeman:
>
I'm used from C programming to use setresuid() to change the real,
effective and saved uid in one go, and although the os module has some
of the set*uid() functions it doesn't seem to have setresuid().
no - python offers the posix function setuid. Have a look here:

http://www.opengroup.org/onlinepubs/...ns/setuid.html

Without any further knowledge this should do everything you want from it
and it is available from the posix and/or the os module.

HTH

Matthias
Aug 18 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bob Swerdlow | last post by:
I've created a Python daemon that starts a bunch of BitTorrent downloader process. Everything is working fine when I start the daemon by hand (logged on as root). I can quit the session and see...
6
by: Nils Emil P. Larsen | last post by:
Hello I'm building a daemon in Python. It will measure and control some physical devices on a serial bus. Since it is a daemon, it will never terminate and I can't interfere with the regulation...
0
by: Jon Monteleone | last post by:
Greetings, I posted a few days back and didnt get much of a response, so I figured I would post again with more detail. I am running gnome under fedora core 4. I want a kid to be able to drop a...
1
by: David Pratt | last post by:
Hi. I am running a zope server. Zope runs 4 threads and I have a document processing method that can require minutes to run so I do not want to run out of threads. A solution to this is to run...
3
by: Thomas Dybdahl Ahle | last post by:
Hi, I'm writing a program, using popen4(gnuchess), The problem is, that gnuchess keeps running after program exit. I know about the atexit module, but in java, you could make a process a daemon...
10
by: NinjaZombie | last post by:
Hi! I was wondering if it is possible to turn the current python proccess into a unix daemon, but not doing it like this: python myscript.py & but from code programaticaly. Thanks.
852
by: Mark Tarver | last post by:
How do you compare Python to Lisp? What specific advantages do you think that one has over the other? Note I'm not a Python person and I have no axes to grind here. This is just a question for...
9
by: Sakagami Hiroki | last post by:
Hi, What is the easiest way to create a daemon process in Python? Google says I should call fork() and other system calls manually, but is there no os.daemon() and the like? Regards, --...
6
by: Johny | last post by:
Is it possible to run a Python program as daemon? Thanks
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.