Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!mit-eddie!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.questions Subject: Re: Need Help! Keywords: help, question, UID, EUID Message-ID: <1991Feb26.153426.26957@athena.mit.edu> Date: 26 Feb 91 15:34:26 GMT References: <12450@ur-cc.UUCP> Sender: news@athena.mit.edu (News system) Distribution: usa Organization: Massachusetts Institute of Technology Lines: 22 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@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710