set.user {unixtools} | R Documentation |
set.user
attempts to change the user running the current
process. Note that this is only possible if the process has the
privilege to do so.
set.user(name, gid = NA)
name |
either a string specifying the username or an integer
specifying the |
gid |
optional, integer, desired |
set.user
can be used in two ways: with a user name or with a
specific uid
/gid
combination. If used with a user name,
then set.user
attempts to find the user in the user database,
changes the uid
, gid
and supplemental groups according
to the user database.
When name
is a number, then set.user
only sets the
uid
and (if gid
is specified) gid
. Supplemental
groups are not changed in that case.
This function is typically used when R is started with elevated
privileges (or is suid
) and it needs to relinquish those to run
as a particular user. The recommended way is to use the username and
not the uid
/gid
specification.
The function will raise an error if either of the required steps fails.
integer, uid
if used with a username, TRUE
otherwise
When changing users, make sure you also change the permissions for
tempdir()
before you change the user. Otherwise R will
not function properly as it cannot create temporary files.
Simon Urbanek
## Not run:
set.user("myname")
## End(Not run)