Linux - NewbieThis 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!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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?
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.
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.
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".
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 &
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!
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 &
Password: [sander@localhost sander]$ su -c "echo hello"
+ Stopped su -c nautilus
[sander@localhost sander]$ su -c xclock
Warning: Tried to connect to session manager, Authentication Rejected, reason :
None of the authentication protocols specified are supported and host-based authentication failed
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"!