LinuxQuestions.org
Visit Jeremy's Blog.
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 11-05-2009, 04:35 AM   #1
kapilbajpai88
Member
 
Registered: Jul 2008
Location: Bangalore, India
Distribution: RHEL
Posts: 235

Rep: Reputation: 41
Question Sudo password


Hi All,

I have recently installed RHEL-5 on my working comp at office. After the successful installation, I created few local users as well.
Now when I ma trying few applications from my local user, say oracle, I am getting permission related problems, and those are obvious. When I am doing "sudo" in such scenarios, it is asking for a sudo password.

As far as I remember, I didn't set any password during installation, apart from ROOT. Could anybody suggest me what would be the SUDO password, if it is something default set by the OS itself ? Otherwise, how can I set it properly, so that I can provide that whenever it ask me to put that ?

Thank you all in advance,
Kapil.
 
Old 11-05-2009, 04:48 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,797

Rep: Reputation: 282Reputation: 282Reputation: 282
The sudo password is the password of the current user.

I'm not familiar with RHEL, so I'm not sure if it by default sets up sudoers. You can simply test it by running sudo yourcommand as a normal user as shown below (from my slackware box)
Code:
wim@btd-techweb01:~$ sudo fdisk -l
Password: wim's normal password
wim is not in the sudoers file.  This incident will be reported.
wim@btd-techweb01:~$
If you want to use sudo, you need to use visudo as root to create/edit the sudoers file.
 
Old 11-05-2009, 05:37 AM   #3
kapilbajpai88
Member
 
Registered: Jul 2008
Location: Bangalore, India
Distribution: RHEL
Posts: 235

Original Poster
Rep: Reputation: 41
Question

Hi Wim,

Thank you for the reply.
I tried local user's current password, then root's password, and later no password as well, but all of them failed. I got the same error message , like what u got there.

Even I am not sure about this as didn't think of this till now. Maybe we might some information on this soon.

Regards,
Kapil.
 
Old 11-05-2009, 06:05 AM   #4
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Try the su command. It changes the user but need the password of the user itself (unless your root). So su to root and then visudo.


Cheers Zhjim
 
Old 11-05-2009, 06:35 AM   #5
kapilbajpai88
Member
 
Registered: Jul 2008
Location: Bangalore, India
Distribution: RHEL
Posts: 235

Original Poster
Rep: Reputation: 41
Question

Hi Zhjim,

Still it is not clear that if I didn't set the sudo password, then which password to use.

I tried this /etc/sudoers file, but what parameter to edit to get the local users working. Infact what I get from that file is that we can make local users to access some root level commands through sudoers file.

Please correct me , if I got that wrong.

Regards,
kapil
 
Old 11-05-2009, 06:57 AM   #6
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Hi Kapil,

Sudo is a method to raise permissions to root level, however any account with such access must be declared in the /etc/sudoers file.

The most common sudo declaration is

root ALL=(ALL) ALL

This means that the root account itself is able to sudo anything (relatively pointless in some respects but doesn't effect anything security wise). If you copy and paste the line and change it as follows

user1 ALL=(ALL) ALL

This grants user1 full sudo access to the system, so that the user can do "sudo yum install mysqld" for example and will be prompted to enter the sudo password, this is a fairly insecure method of setting up sudo and should only be done to very trusted users, generally only system administrators. Sudo can be set-up to work only with certain commands or groups of commands and be also be set-up to not prompt for passwords, however if something is worth sudoing I generally believe it's worth ensure proper checks are performed.

A quick example of why the previous is dangerous are commands such as "sudo passwd root" or "sudo su -" allows users to either reset the entire root password or actually raise themselves to the root user itself.

I have found this site for a fairly basic method of how to configure /etc/sudoers.
 
Old 11-05-2009, 04:18 PM   #7
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
I like the tutorial on the link you provieded r3sitence. Just one thing I like to stress on. There are two kind of passwords setup one can use within /etc/sudo. Either use the root password or the user password that is calling sudo. I just skimmed the tut and did not really saw a section that made that clear.

@kapilbajpai88
If you did not set a password for using sudo there is none. To make it clear: You first need to setup sudo to have it recognise any kind of password (better put to even function).
So check on the tutorial r3sistance linked to to have some idea how sudo is about to work. Just have in mind to be root to use visudo like the tutorial says.

remarks to the tut:
Why interrupt the installation with >CTRL+Z>? As far as I've learned the <CTRL+Z> puts the running program into the background... Would'nt <CTRL+C> be the right option to interrupt the process?

Later Zhjim
 
Old 11-06-2009, 12:32 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,434

Rep: Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790Reputation: 2790
Classically, there are 3 ways to get root access:

1. login as root at the cli and use root passwd
2. login as a std user, then

su -

( the '-' gives you root's env) and enter root passwd
3. login as std user, then

sudo <somecmd>

and enter user's normal passwd (no such thing as a 'sudo passwd').
Requires that you first enable sudo access via the 'visudo' cmd as the root user

HTH
 
Old 11-06-2009, 02:03 AM   #9
MrCode
Member
 
Registered: Aug 2009
Location: Oregon, USA
Distribution: Arch
Posts: 864
Blog Entries: 31

Rep: Reputation: 148Reputation: 148
Quote:
Code:
This incident will be reported.
Sorry to be OT but this just bugs me. Some poor soul (who's NOT in an office/work-type environment where they genuinely COULD get in trouble) is gonna see that and take it way too seriously. It's like the Linux equivalent of the old Win 95/98 "Illegal Operation" error. Same with the "We trust you have had the lecture from your local system administrator" thing or whatever it says.

Last edited by MrCode; 11-06-2009 at 02:06 AM.
 
Old 11-06-2009, 03:15 AM   #10
imagine_me2
Member
 
Registered: Nov 2009
Location: Kolkata, India
Distribution: Fedora 11
Posts: 136

Rep: Reputation: 22
You will need to set the valid sudoers. For that purpose use as root,

#visudo,

using this you can safely edit /etc/sudoers file.

Now look for

"## Allows people in group wheel to run all commands"

below that add a line

"%user ALL=(ALL) ALL"

without quotes, replace user with the desired user name
save and exit.

Now login as user and use

$sudo [command] etc

Your sudo password is your login password.
There are many other settings that can be used to achieve desired control. Read through the /etc/sudoers file for details
 
  


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
No password for sudo? orange400 Linux - Software 9 03-18-2012 10:08 AM
my sudo password is not the root password newbiesforever Linux - General 7 01-02-2010 09:59 PM
sudo password...? yubimusubi Linux - General 15 09-04-2009 12:08 AM
changing the sudo password? SSJGoku Fedora 1 05-17-2009 06:04 PM
Require sudo to need 2 password Dralnu Linux - Security 2 05-19-2006 08:52 PM

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

All times are GMT -5. The time now is 02:47 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