Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Say I'm logged in as root, but I want to run a program as a normal user, because that's the only way it will run, and I don't want to log out then log back in again. Yes, I know I could do ALT+F2 or something and go to a different terminal, but that's logging in again, and my password is difficult to type, so I don't want to do that. Is there some trick to running a program as a different user?
Or you could log in as your user, go to a console in X, type su and run that app as root. But why would you want to change users??? Its not very secure. Now, you will have to run some apps as root, but constantly changing users is stupid.
But to answer your question, create an icon on your desktop to run the app. Right click on the icon, click properties. Click on the tab called execute
click on the checkbox called "Run as differen't user" and type in the username in the little text box under it.
Ok, thanks for your reply. The reason I ask this is in RH9 there is /etc/rc.local which runs programs at startup. Unfortunately it runs them as root so I need to set it to run them as a regular user, because some programs don't recomend being run by root/won't be run by root.
Also, to make it easier to deal with quotes and such, it's generally easier to write a script that requires no arguments and passes required arguments to the program, does redirection, etc. You then call the script with su -c <scriptname> <user> and let the script do all the setup, redirection, etc. which is already running as <user>.
from djtoltz in an e-mail and it worked perfectly! Thanks!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.