LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-04-2010, 03:57 AM   #1
john83reuben
Member
 
Registered: Oct 2007
Location: Kuala Lumpur,Malaysia
Distribution: Debian Etch, OpenSuse
Posts: 132

Rep: Reputation: 17
login to root without password (ubuntu 8.04)


Hi All,

When I try to do

Quote:
sudo su root
The login is successful without prompting a password. This is dangerous.
How am I going to avoid/disable this?

Thanks

Jon

Last edited by john83reuben; 09-04-2010 at 04:28 AM. Reason: I change with to without
 
Old 09-04-2010, 04:20 AM   #2
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 101Reputation: 101
I don't understand. Why do you think prompting a password is dangerous? If you want to login without password, you can add the line below to /etc/sudoers:
Code:
<your_user>	ALL=(ALL)	NOPASSWD:ALL
 
Old 09-04-2010, 04:27 AM   #3
john83reuben
Member
 
Registered: Oct 2007
Location: Kuala Lumpur,Malaysia
Distribution: Debian Etch, OpenSuse
Posts: 132

Original Poster
Rep: Reputation: 17
Hi quanta,

I mean i login to the machine as a normal user, ..lets say john

This is what happens

Quote:

john@john-laptop:~$ sudo su root
root@john-laptop:/home/john#
I was able to access root without a password. I am afraid if others was using my box, and this might be a problem if they access my root account.

Thanks

John
 
Old 09-04-2010, 06:27 AM   #4
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7/10
Posts: 893

Rep: Reputation: 119Reputation: 119
I think I might have your fix. Do this

Quote:
sudo visudo
and look for this line
Quote:
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=NOPASSWD: ALL
Its pretty self explanatory.

Just put a # in from of %sudo ALL=NOPASSWD: ALL

should look like this
Quote:
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
#%sudo ALL=NOPASSWD: ALL
Good luck to you.

Last edited by jmc1987; 09-04-2010 at 06:29 AM. Reason: had to fix an error
 
Old 09-04-2010, 06:35 AM   #5
urgrue
LQ Newbie
 
Registered: Aug 2010
Location: Belgium
Distribution: RHEL, Fedora, Ubuntu
Posts: 3

Rep: Reputation: 0
Quote:
Originally Posted by jmc1987 View Post
Just put a # in from of %sudo ALL=NOPASSWD: ALL
This also means he can't sudo at all, which can be inconvenient.
If you still want sudo to work, but to prompt for a password, just remove the NOPASSWD: part (so its just %sudo ALL=(ALL) ALL).
 
Old 09-04-2010, 06:43 AM   #6
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7/10
Posts: 893

Rep: Reputation: 119Reputation: 119
No he can still sudo. This is default with ubuntu

Quote:
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults env_reset

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL

# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
This is my /etc/sudoers and I use my pass when I sudo. I have been using ubuntu 9.04 as my desktop late
 
  


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 does on login as the root ? And what password do I use for it ? vigdavies Linux - Newbie 28 10-17-2009 07:53 PM
Password Recovery in Edubuntu 7.04 - In Terminal, Root Login : su , password : ????? farhannaeem13 Linux - Security 3 11-30-2007 09:59 AM
How to set login and password and root password in suse 10.2 sirius57 SUSE / openSUSE 8 07-24-2007 09:51 AM
root login password barrythai Ubuntu 1 12-25-2006 12:26 PM
ROOT LOGIN OK, su password NOT OK Darrell_Thomas_ Linux - Security 3 10-19-2004 02:32 PM

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

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

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