Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
08-18-2003, 03:10 PM
|
#1
|
LQ Newbie
Registered: Feb 2002
Location: Netherlands
Posts: 10
Rep:
|
How to pass root permissions to other app?
Hi,
My question:
when I am logged in as a normal user and I want to do something that requires root permissions I don't want to log out and log in every time. I know there is a way to pass the root permissions that you get when you "su" on a command line to any X-application you want to, for instance nautilus.
However I forgot how. Can anyone help me?
Thanks in advance
Therut
|
|
|
08-18-2003, 03:44 PM
|
#2
|
Member
Registered: Jul 2003
Location: Boston, MA, USA
Distribution: RedHat, SuSE, Gentoo, Slackware, Mandrake ...
Posts: 111
Rep:
|
Use the su command's -c option to start up the program you want to have root permissions. For example, if you want to run xmms as root, you could use: "su -c xmms". Of course, root won't be able to use your X display unless you grant it permission. Use "xhost localhost" if you're the only user on that system, or xauth for better security.
|
|
|
08-18-2003, 04:00 PM
|
#3
|
LQ Newbie
Registered: Feb 2002
Location: Netherlands
Posts: 10
Original Poster
Rep:
|
Hi Mack,
thanks for replying so quickly.
I have a new question now, of course.
The main app I would like root permissions for when I'm logged in as a normal user is Nautilus (red hat 9). For instance, when I want to copy a group of folders from a cdrom to a mounted fat partition it's faster for me to do it with nautilus because i am not really used to working with the command line. However, when I want to do that Nautilus tells me, logically, that I don't have the permissions. So this way, with the -c option, i don't have to log out anymore.
But something strange happens: first of all the bash shell where I type the command "su -c nautilus" gives me the following reply, although it does start nautilus in the root folder:
"GnomeUI-WARNING **: While connecting to session manager:
Authentication Rejected, reason : None of the authentication protocols specified are supported and host-based authentication failed.
Extra content at the end of the document."
Second of all I am now stuck with that bash terminal because when I close that terminal the nautilus windows closes as well?
I hope you don't mind me asking such a longwinded question.
Thanks in advance,
Therut
|
|
|
08-18-2003, 04:07 PM
|
#4
|
Member
Registered: Jul 2003
Location: Boston, MA, USA
Distribution: RedHat, SuSE, Gentoo, Slackware, Mandrake ...
Posts: 111
Rep:
|
Hmm... Not sure where that Gnome-UI-Warning is coming from. It's probably trying to authenticate to your X server and failing. Did you use "xhost localhost" so that any user on your system (including root) can access your X display?
The second question is easy: just run the command in the background by putting an ampersand at the end of the command line. Then when you exit the shell, the command will be left running in the "background".
|
|
|
08-18-2003, 04:29 PM
|
#5
|
LQ Newbie
Registered: Feb 2002
Location: Netherlands
Posts: 10
Original Poster
Rep:
|
Hi Mack,
thanks for all the help.
yes I typed xhost localhost. Then the shell answers: "localhost being added to access control list"
I have really no idea what or why i do that but it didn't change that what follows the su -c nautilus command.
On the ampersand answer: Where should I put the ampersand? I tried every possible location in the line but it never does what i want it to do.
su& -c nautilus
su -c& nautilus
su -c & nautilus
su -c nautilus&
su -c nautilus &
?
Thanks in advance, again,
Therut
|
|
|
08-18-2003, 04:35 PM
|
#6
|
Member
Registered: Jul 2003
Location: Boston, MA, USA
Distribution: RedHat, SuSE, Gentoo, Slackware, Mandrake ...
Posts: 111
Rep:
|
The ampersand belongs at the end:
su -c nautilus &
because it's a command separator to the shell. Let's see if we can find out where that message is coming from. Try running a non-X command with su to see if it gets the error:
su -c "echo hello"
I'll bet that works just fine. Now, let's try a basic X application:
su -c xclock
If that gives the same warning, then the problem is with generic XWindows authentication somehow. If not, then it's something that nautilus is doing. I don't know anything about nautilus, so I can't be of much help there. Let us know your results!
|
|
|
08-18-2003, 04:49 PM
|
#7
|
LQ Newbie
Registered: Feb 2002
Location: Netherlands
Posts: 10
Original Poster
Rep:
|
Hi Mack,
First I tried to put the ampersand at of the end of the line, nothing happens except an "answer" in the shell. Then I did the other things you said and you were right. The "echo hello" thing was no problem, but the "xclock" thing gives the same error message.
Now I will paste everything from that shell so you can see what I did and what happened:
[sander@localhost sander]$ su -c nautilus &
[1] 4637
Password: [sander@localhost sander]$ su -c "echo hello"
Password:
hello
[1]+ Stopped su -c nautilus
[sander@localhost sander]$ su -c xclock
Password:
Warning: Tried to connect to session manager, Authentication Rejected, reason :
None of the authentication protocols specified are supported and host-based authentication failed
Hope this helps, thanks still for helping,
Sander (Therut)
|
|
|
08-19-2003, 09:19 AM
|
#8
|
Member
Registered: Jul 2003
Location: Boston, MA, USA
Distribution: RedHat, SuSE, Gentoo, Slackware, Mandrake ...
Posts: 111
Rep:
|
I know why the ampersand thing isn't working. I wasn't thinking this through all the way. Sorry about that. What's happening is that your shell is running the su command in the background, so when it prompts for a password it isn't getting any input from your keyboard (your shell is still reading that). What I should have had you do is run su in the foreground, and have it run nautilus in the background. This can be done by including the ampersand in the argument to the -c option by quoting it:
su -c "nautilus &"
Doing that lets su prompt for and read a password from your terminal in ithe foreground.
But we still have the authentication problem. I'm no XWindows expert, but it looks like your X server doesn't support the protocols your X client is trying. What's even stranger is that host-based authentication failed. Run xhost with no arguments. Does i say:
access control enabled, only authorized clients can connect
then t list "localhost" as an authorized client? You could try "xhost +", which disables host-based authentication so that anyone can connect. Don't leave it like that after testing, though, enable it with "xhost -" again. If that worked, try adding your hostname to the list with "xhost `hostname`" (note the backticks) and see if that works.
Also what is the output of "xhost info"? And look at the output of "xhost list" to see if your display name has a MIT-MAGIC-COOKIE-1 protocol entry for it. But don't post the output of "xauth list"!
|
|
|
All times are GMT -5. The time now is 05:05 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|