LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
Search this Thread
Old 12-14-2005, 04:44 PM   #1
matiasquestions
Member
 
Registered: Sep 2005
Posts: 65

Rep: Reputation: 15
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!
 
Old 12-14-2005, 06:52 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,547

Rep: Reputation: 180Reputation: 180
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
 
Old 12-14-2005, 08:06 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,450
Blog Entries: 54

Rep: Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893Reputation: 2893
(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.
 
Old 12-14-2005, 08:58 PM   #4
infiniphunk
LQ Newbie
 
Registered: Sep 2005
Location: Thunder Bay ON
Distribution: Slackware,Zenwalk,Ubuntu
Posts: 20

Rep: Reputation: 0
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?
 
Old 12-15-2005, 01:20 AM   #5
matiasquestions
Member
 
Registered: Sep 2005
Posts: 65

Original Poster
Rep: Reputation: 15
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.
 
Old 12-15-2005, 01:23 AM   #6
matiasquestions
Member
 
Registered: Sep 2005
Posts: 65

Original Poster
Rep: Reputation: 15
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.
 
Old 12-15-2005, 01:44 AM   #7
coolpyrofreak
Member
 
Registered: Mar 2004
Location: Las Vegas, NV
Distribution: Arch Linux
Posts: 103

Rep: Reputation: 15
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.
 
Old 12-15-2005, 02:04 AM   #8
matiasquestions
Member
 
Registered: Sep 2005
Posts: 65

Original Poster
Rep: Reputation: 15
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.
 
Old 12-15-2005, 02:37 PM   #9
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
Quote:
Originally Posted by infiniphunk
Unless you're already root, right?
heheheh I was going to post the same thing.
 
  


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
How could normal user obtain root password or change root password ckamheng Debian 18 02-18-2009 10:28 PM
Booting into Single User on MDK 9 asks for root password instead of booting into root acadcworks Linux - General 6 01-10-2006 06:51 AM
root password kaplan71 Ubuntu 1 08-02-2005 05:30 PM
Logged in as root, prompted for root password ta0kira Slackware 13 04-25-2005 01:29 AM
root password neozero62 Linux - Newbie 5 11-05-2003 10:05 AM


All times are GMT -5. The time now is 06:01 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration