Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
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.
|
 |
12-14-2005, 04:44 PM
|
#1
|
Member
Registered: Sep 2005
Posts: 65
Rep:
|
su root (without asking for password)
Hi!
I want to switch to root with the command "su root" but without having to enter the root password every time.
Anyone knows how to do it???
(I've found googling something about sudo -s but that isn't usefull in my case...)
Thanks!
|
|
|
12-14-2005, 06:52 PM
|
#2
|
LQ Guru
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,385
|
Quote:
Originally Posted by matiasquestions
Hi!
I want to switch to root with the command "su root" but without having to enter the root password every time.
Anyone knows how to do it???
(I've found googling something about sudo -s but that isn't usefull in my case...)
Thanks!
|
You can't. It is basic design in Linux that you cannot switch users without providing the new user password.
---------------------
Steve Stites
|
|
|
12-14-2005, 08:06 PM
|
#3
|
Moderator
Registered: May 2001
Posts: 29,417
|
(I've found googling something about sudo -s but that isn't usefull in my case...)
With sudo you can use the "NOPASSWD" tag to prevent asking for a password. Of course you (should) understand the implications of allowing anyone root account access w/o having to know the pass. At least use something with logging capabilities like rootsh instead of su if you're not the only one who will have root account access this way.
|
|
|
12-14-2005, 08:58 PM
|
#4
|
LQ Newbie
Registered: Sep 2005
Location: Thunder Bay ON
Distribution: Slackware,Zenwalk,Ubuntu
Posts: 20
Rep:
|
Quote:
Originally Posted by jailbait
You can't. It is basic design in Linux that you cannot switch users without providing the new user password.
---------------------
Steve Stites
|
Unless you're already root, right?
|
|
|
12-15-2005, 01:20 AM
|
#5
|
Member
Registered: Sep 2005
Posts: 65
Original Poster
Rep:
|
I think that there must be any way to do this.... I can remotely access to a my server throught ssh with a ssh public/private key, without password, also I can switch to root by typing "sudo -" (and having the apropiates entries in /etc/sudoers).....
So, I think that something similar must be....let's continue googling.... If I found the way, I'll tell you...
Thanks everybody.
|
|
|
12-15-2005, 01:23 AM
|
#6
|
Member
Registered: Sep 2005
Posts: 65
Original Poster
Rep:
|
sudo and .bashrc
Quote:
Originally Posted by unSpawn
(I've found googling something about sudo -s but that isn't usefull in my case...)
With sudo you can use the "NOPASSWD" tag to prevent asking for a password. Of course you (should) understand the implications of allowing anyone root account access w/o having to know the pass. At least use something with logging capabilities like rootsh instead of su if you're not the only one who will have root account access this way.
|
Hi!
I can do this with sudo, but the problem is that this way, isn't run the .bashrc file of root.... and I've some things I need to be run when a root session is opened.
Thanks for replying.
|
|
|
12-15-2005, 01:44 AM
|
#7
|
Member
Registered: Mar 2004
Location: Las Vegas, NV
Distribution: Arch Linux
Posts: 103
Rep:
|
log in as root, then type "visudo". add this line to the section that says "# Members of the admin group may gain root privileges":
user ALL=(ALL) NOPASSWD: ALL
where "user" is your real user name. then all commands that you need to run as root can be preceded with "sudo" and it will run with root privileges. you can also do "sudo su" which will give you the root shell without the password.
|
|
|
12-15-2005, 02:04 AM
|
#8
|
Member
Registered: Sep 2005
Posts: 65
Original Poster
Rep:
|
Quote:
Originally Posted by coolpyrofreak
log in as root, then type "visudo". add this line to the section that says "# Members of the admin group may gain root privileges":
user ALL=(ALL) NOPASSWD: ALL
where "user" is your real user name. then all commands that you need to run as root can be preceded with "sudo" and it will run with root privileges. you can also do "sudo su" which will give you the root shell without the password.
|
Great!!!
I had already that line, but I didn't realised of doing "sudo su" instead of "sudo -s".
Just what I was looking for. Thanks a lot.
|
|
|
12-15-2005, 02:37 PM
|
#9
|
Senior Member
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794
Rep:
|
Quote:
Originally Posted by infiniphunk
Unless you're already root, right?
|
heheheh I was going to post the same thing. 
|
|
|
All times are GMT -5. The time now is 07:25 PM.
|
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
|
|