LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 04-18-2010, 01:37 PM   #1
saagar
Member
 
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Rep: Reputation: 37
Usage of sudo command in Ubuntu and Red Hat


Friends,
In Red Hat, suppose if root user wishes to give a privilege to run the fdisk command to a user named sam. And he makes appropriate configuration changes in /etc/sudoers file.
Now when sam wishes to run the fdisk command, then he has to issue:

Code:
[sam@system43~]$sudo /sbin/fdisk -l
   Password: ***
But in ubuntu, after the same configuration being done, what sam needs to do is:
Code:
[sam@somesystem43~]$sudo fdisk -l
   Password: ***
That means, in ubuntu the user need not type the full path of the command.
I wish to know how can I make red hat system work like ubuntu as far as the sudo usage is concerned.
Thanks...

Last edited by saagar; 04-18-2010 at 01:43 PM.
 
Old 04-18-2010, 01:47 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by saagar View Post
Friends,
In Red Hat, suppose if root user wishes to give a privilege to run the fdisk command to a user named sam. And he makes appropriate configuration changes in /etc/sudoers file.
Now when sam wishes to run the fdisk command, then he has to issue:

Code:
[sam@system43~]$sudo /sbin/fdisk -l
   Password: ***
But in ubuntu, after the same configuration being done, what sam needs to do is:
Code:
[sam@somesystem43~]$sudo fdisk -l
   Password: ***
That means, in ubuntu the user need not type the full path of the command.
I wish to know how can I make red hat system work like ubuntu as far as the sudo usage is concerned.
Thanks...
Has nothing to do with SUDO. You need to modify the PATH environment variable, to include whatever directories you want. So modify the root .bashrc/.profile file accordingly.
 
1 members found this post helpful.
Old 04-18-2010, 02:00 PM   #3
saagar
Member
 
Registered: Jul 2008
Location: Chennai, India
Distribution: RHEL5, Ubuntu
Posts: 191

Original Poster
Rep: Reputation: 37
Thanks TBone for the quick reply.
Now I got it.

In Ubuntu, any user will have /sbin, /usr/local/sbin, etc...directories in his path by default even if he is not a sudo user. So, once he is given a sudo privilege for a set of commands or a particular command, he only has to type sudo followed by the command(no need for the full path)
But in Red Hat, by default, the path for running those commands are not set for a normal user by default. So, the sudo user needs to type in the full path. To make this work, the appropriate paths need to be added in his .bashrc file.

Thanks.

Last edited by saagar; 04-18-2010 at 02:02 PM.
 
Old 04-18-2010, 06:49 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
The problem with that is he can run any cmd in that new dir (eg /sbin), which is not necessarily what you want. If you want specific cmds only, use sudo in the same way, it's the same on all Linux.
 
  


Reply



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
Red Hat: Can Apache be installed with sudo or.... tjamnz Linux - Newbie 3 09-07-2007 12:23 AM
sudo command usage??? pagadala_cs Linux - Software 1 12-24-2004 10:13 AM
question about rm command on Red Hat 9 rharvey@cox Red Hat 16 10-20-2003 08:21 AM
Red Hat 7.2 command j0ck Linux - General 2 11-21-2002 12:18 PM

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

All times are GMT -5. The time now is 03:18 AM.

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