id userid

Part of the TclX package.

id userid ?uid?

Queries the current userid or, if uid is given, sets it. Setting the userid usually requires root permission.