LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 08-18-2003, 03:10 PM   #1
therut
LQ Newbie
 
Registered: Feb 2002
Location: Netherlands
Posts: 10

Rep: Reputation: 0
Unhappy 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
 
Old 08-18-2003, 03:44 PM   #2
MacKtheHacK
Member
 
Registered: Jul 2003
Location: Boston, MA, USA
Distribution: RedHat, SuSE, Gentoo, Slackware, Mandrake ...
Posts: 111

Rep: Reputation: 15
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.
 
Old 08-18-2003, 04:00 PM   #3
therut
LQ Newbie
 
Registered: Feb 2002
Location: Netherlands
Posts: 10

Original Poster
Rep: Reputation: 0
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
 
Old 08-18-2003, 04:07 PM   #4
MacKtheHacK
Member
 
Registered: Jul 2003
Location: Boston, MA, USA
Distribution: RedHat, SuSE, Gentoo, Slackware, Mandrake ...
Posts: 111

Rep: Reputation: 15
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".
 
Old 08-18-2003, 04:29 PM   #5
therut
LQ Newbie
 
Registered: Feb 2002
Location: Netherlands
Posts: 10

Original Poster
Rep: Reputation: 0
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
 
Old 08-18-2003, 04:35 PM   #6
MacKtheHacK
Member
 
Registered: Jul 2003
Location: Boston, MA, USA
Distribution: RedHat, SuSE, Gentoo, Slackware, Mandrake ...
Posts: 111

Rep: Reputation: 15
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!
 
Old 08-18-2003, 04:49 PM   #7
therut
LQ Newbie
 
Registered: Feb 2002
Location: Netherlands
Posts: 10

Original Poster
Rep: Reputation: 0
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)
 
Old 08-19-2003, 09:19 AM   #8
MacKtheHacK
Member
 
Registered: Jul 2003
Location: Boston, MA, USA
Distribution: RedHat, SuSE, Gentoo, Slackware, Mandrake ...
Posts: 111

Rep: Reputation: 15
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"!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu doesn't ask for root pass during install?? Ay-Karamba! Ubuntu 1 09-02-2005 04:50 AM
Lost root pass word luckyvietman Linux - Newbie 11 06-01-2005 09:13 AM
root pass blank/redhat9 rohan208 Linux - General 3 05-07-2004 05:06 PM
MySQL root pass tommytomato Linux - Newbie 0 02-02-2004 06:34 AM
problem regarding on admin and root pass glacier1985 Linux - Newbie 5 07-13-2003 08:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration