[SOLVED] Usage of sudo command in Ubuntu and Red Hat
Linux - NewbieThis 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
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.
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.
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...
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.