Results 1 to 6 of 6
I downloaded a firefox linux package
uncompress it and put it under my home dir
when I 'cd' into firefox and run the following command with my user account "esolve"
...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-14-2012 #1Just Joined!
- Join Date
- May 2012
- Posts
- 82
strange problem with sudo -u
I downloaded a firefox linux package
uncompress it and put it under my home dir
when I 'cd' into firefox and run the following command with my user account "esolve"
it works fineCode:./firefox
but when I switch to root account, and run
I see the errors below, and firefox can't be opened, THEN I tried to modify the package owner: chown -R esolve:esolve firefox, the error persists and firefox still can't be openedCode:sudo -u esolve ./firefox
if I just run it as root account, there will be errors but firefox can still be openedCode:Error: Access was denied while trying to open files in your profile directory
I tried the same version of firefox package in another linux machine before and when I'm with root account
"sudo -u esolve ./firefox " works fine
what is wrong with this? it is strange
BTW, the user account esolve was created by useradd
maybe this is a problem? coz when I open the terminal, the default shell is /bin/sh
I have to mannually change SHELL=/bin/bash, and even if I put a .bashrc with such a line under homedir,
the .bashrc.doesn't seem to work
coz I need to use "sudo -u esolve ./firefox " in a script, otherwiser I will just switch to esolve and run ./firefox
so I hope to deal with this errorLast edited by esolve; 11-14-2012 at 11:33 AM.
- 11-14-2012 #2
sudo -u mean 'run as another user', take a look at the sudo man page.
The syntax should be
which is what you have in the other examples you've provided. If you don't want to provide a username, then drop the '-u' argument altogether.Code:sudo -u <username> <application>
Linux user #126863 - see http://linuxcounter.net/
- 11-14-2012 #3Just Joined!
- Join Date
- May 2012
- Posts
- 82
sorry, my original post ignored the username, now I have modified it, I used sudo -u <username> <application>
- 11-14-2012 #4Linux Newbie
- Join Date
- Jun 2012
- Location
- SF Bay area
- Posts
- 101
If you're already "root" you don't need to use "sudo" to execute a program as another user. You can just use "su esolve -c firefox".
- 11-14-2012 #5Linux Enthusiast
- Join Date
- Apr 2012
- Location
- Virginia, USA
- Posts
- 561
What distro are you running? Default for Linux distros is typically /bin/bash
To change this, you can edit /etc/passwd file using the command 'vipasswd' (as root).
Then, just replace /bin/sh with /bin/bash on the appropriate line. This requires knowledge of vi/vim (depending on distro) which can be a little tricky to use if you've never used it before.
To change default shell for user add, edit /etc/default/useradd (That's what it is in RHEL-based distros, not sure offhand what it might be in debian or others).
- 11-15-2012 #6Just Joined!
- Join Date
- Mar 2008
- Posts
- 18


Reply With Quote

