Need Help!

Jonathan I. Kamens jik at athena.mit.edu
Wed Feb 27 02:34:26 AEST 1991


  The easiest way to switch to another UID temporarily is to run "su
username2" and type the second user's password.  You'll get a new shell as the
second user, and you can continue to work with access to that user's files
etc.  You can suspend that shell and go back to it as you wish, or exit from
it when you're done and get back to your original shell as username1.

  It is possible to use the setuid() etc. calls to switch to another UID, but
to do that, the program doing the setuid() has to either be root, or be
running setuid the user that you want to switch to.  So, if you create a
program as username2, assign it a group that has only username1 in it, make it
group and world-executable but not world-executable, and then make it setuid
username2, that program will be able to switch to username2's UID when it is
run.  You can put calls in it to do the appropriate setuid() calls (although
you might not even have to do any such calls, since it's running setuid
username2) and run it as username1.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.questions mailing list