Change user on UNIX
gnewsg at gmail.com
Fri Mar 28 03:28:45 CET 2008
Sorry for replying so late.
I'll try to describe what I'm actually trying to implement so that
maybe it can help you understand a little better.
The application is an asynchronous FTP server implementation.
I decided that it would be desirable to change the current
implementation so that every time a filesystem operation is going to
be made I
temporarily change the current process ID to reflect the current
logged-in user, execute the filesystem call and then switch back to
the original process ID.
authorizer = UnixAuthorizer()
f = open(filename, 'w')
The UnixAuthorizer class is expected to provide the mechanism to
change the current user (presumably via os.setegid()/os.seteuid()) and
then switch back to the original one.
Since we're talking about an asynchronous environment I tought that
temporarily changing the process ID was the only way to do this.
I'm sincerely not skilled enough about the UNIX world to know which
are the security implications behind such an approach.
Do you think it is reasonable?
More information about the Python-list