su + environment
Everyone knows that$ su fubar<password>switches user over to, in this case, a user named fubar.However, this doesn't bring along with it fubar's user environment; so, for instance, if you have su'd over to fubar and an app you are using needs to write a file into /home/fubar/.kde file, then that app will not be able to do it because you are fubar but you are not in fubar's user environment.OK, so to switch over to fubar + fubar's world, you must do this:# su - fubar<password>Note the - (dash) between the su and the fubar Now you can do everything the user fubar would normally be able to do without any unexpected permission errors.(I have to thank Popey for that tip; he saved my life with it while I was flirting with postfix. I was amazed I'd never encountered that seemingly basic yet vital distinction in all the beginning UNIX books and courses I've taken........)
2 Comments
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign In Now