uidchg

change the uid of a running process

Intro

uidchg is a simple kernel module that changes the uid, euid, and fsuid of a running process. It was originally written to recover a screen session that was inaccessible because the owner's uid had changed after the switch to a central user directory.

Usage

The module acts more like a program than a device driver:
insmod ./uidchg.ko chpid=17443 chuid=65534
In this case, I am changing the owner of process 17443 (a vim session) to uid 65534 ('nobody'). The chuid parameter is optional, and defaults to root. Note that the module will /always/ fail to load. This is normal. It changes the uid of the specified process, and then returns an error so that it doesn't stay loaded.

Download

---- NOTE ----
This is a dirty hack and should never be used, ever. For 2.6 kernels. But that doesn't really matter, because you should never use it. =)
---- NOTE ----

Update: 2006/12/17, made module_init always return -EINVAL so module doesn't stay loaded
Update: 2006/11/20, switched from MODULE_PARM to module_param()

Download here
Download old version here