Can I avoid giving password when su-ing to root?
Hi
As the title says, I would like to su without giving the password I'm using fedora 7 with gnome I have already setup sudo without a password for my normal user but I would still like a normal root terminal while avoiding the password the info on su does not provide any information about passing the password as a parameter. I suppose that is out of the question I tried making a file /etc/default/su and writing the line PROMPT=No (or no, I tried both) which according to many websites was supposed to do it, but it doesnt So does anybody know? I dont care about security at this point. The box is just for experimental toying around, I dont care about being compromised. this is a script to open a root terminal in the current directory (right-click on a directory) Code:
#!/bin/sh What I'm really looking for is to remove the password requirement Trying sudo gnome-terminal --working-directory="$dir" instead of gnome-terminal --working-directory="$dir" --command su does not work at all on the script, although it does work on an open terminal Trying gnome-terminal --working-directory="$dir" --command "sudo gnome-terminal --working-directory="$dir"" works but it opens 2 terminals, the original which is unusable and a second one which is usable. But this is rather ugly |
visudo
%admin ALL=NOPASSWD: /bin/su - or user your_user=NOPASSWD: /bin/su - And for the menu rxvt -title "RootShell" -sl 8000 -e sudo su - But I wouldn't recommend that practice.... Cheers, Tink |
sudo -i
sudo -s man sudo |
Very bad idea to disable passwords---bad bad bad.
If you insist, edit the appropriate entries in /etc/passwd to remove the "x" between the first 2 colons, resulting in something like this: root::0:0:root:/root:/bin/bash Did I already say: "BAD IDEA"? |
What Tink and pixellany said.
Very bad idea. Even if you do not care what happens with your box it may present danger others when hijacked. Actually, every serious UNIX user should feel discomfort when running/messing with root, similar feel like driving a car on left lane. You go there if situation calls for it and it's safe but you do not want to stay there. |
Thanks for the replies
I checked out man sudo and tried the -i switch, as emerson suggested Unfortunately, sudo -i gnome-terminal says it cannot execute binary file. editing the /etc/passwd to remove the x worked. It is indeed too radical a solution. Now it never asks for a password. I only wanted it to not ask for the script As for why I want to do this, its because this is my guinea pig box. I only ever test stuff on it, which means I have to become root all the time. The only reason I dont get a root desktop on it is because I want to keep a perspective from the users point of view as well. But getting rid of the password would be extremely convenient. It goes without saying I would never try this in any other case |
Did you try my sudoers suggestion?
Cheers, Tink |
this will make one uber insecure system :)
|
Quote:
I couldnt make it work For user nick I added in visudo the line user nick=NOPASSWD: /bin/su as the last line. It still asked for a password Then I removed it and added the following %admin ALL=NOPASSWD: /bin/su On its own it does nothing again., so I also tried in the shell gpasswd -a nick admin (judging from the walkthrough I have seen with sudo and the wheel group, that should be OK) but it says it knows nothing about group admin I suppose I could have done a %users ALL=NOPASSWD: /bin/su but I suppose its not better that removing the x in /etc/passwd as has been suggested As for rxvt -title "RootShell" -sl 8000 -e sudo su I dont even know where to put it! |
/usr/bin/xterm -e sudo -i
This open a root terminal for me ... |
Quote:
Indeed it does But xterm is not as nice as gnome-terminal The equivalent gnome-terminal command would be gnome-terminal --command "sudo -i" Which is what finally did it for me. Thanks for the help guys. No longer do I need to visudo or mess with /etc/passwd |
Put this into your .Xdefaults and the xterm looks much better. ;)
Code:
~ $ cat .Xdefaults |
You can bypass the password entry for su too, or allow specific users to use their own password. man suauth.
Naturally, I reiterate all the warnings given previously. :) |
All times are GMT -5. The time now is 08:38 AM. |