How to make /usr/sbin accessible and executable globaly.
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
How to make /usr/sbin accessible and executable globaly.
In /usr/sbin, for some reason if I try to just execute any of the commands such as sendmail or xinetd, everything in this directory, I can't just run the command without typing ./ in front of it.
What I'm trying to do is get the OS to allow me to execute any command from the /usr/sbin directory the same way that I can execute the commands in the /usr/bin directory. I can be within any path and execute the commands in the /usr/bin folder without prefixing the ./
Binaries in /usr/sbin are usually things for root to play with. There's 2 solutions for this:
1) Create a symlink in /usr/bin to /usr/sbin but only for the files you want -everyone- to access.
2) Add /usr/sbin to your PATH variable. Have a look in /etc/profile (depending on your distribution)
I would suggest number 1 from a security and safety point of view. To link sendmail to make it available for everyone, as root, just type:
I would suggest number 1 from a security and safety point of view.
Aprox half of the stuff in /usr/sbin is accessed sporadically (check 'sa') by root and the other half isn't even used by wetware but run by initscripts, daemons and such. Adding the dir to your PATH is what you should do. Adding symlinks has no effect whatsoever wrt security. If you want to add it to /etc/profile at least make a clause that only adds the element to the PATH if you're root. If you want to keep it across updates however /etc/profile.d/ would be better or put it in root's .bash_profile. If you need regular users to access those commands use sudo.
sudo doesn't take root's PATH in to account - it looks at the current users PATH.
I guess security was the wrong word - I think the original question was how to allow normal users access to /usr/sbin but I'm curious how many 'normal' users would need direct access to something like the sendmail binary...?
the things in /sbin are also there because they require root abilities, even if you could run them, there is no garentee that they can work as a normal user.
That said, either set it in you PATH, or just type the command location explicitly, like /sbin/ifconfig.
Well, first question then, how do I add /usr/sbin to my path and second, why is there a /sbin and a /usr/sbin? Wouldn't the /sbin be specifically meant for root access and system operations and /usr/sbin for user access?
The /usr directory is not "user", its got its place a long time ago, back when you kept the basic system on one partition, and all the real programs/applications on another. /usr is that other partition's mount point, and / was used for essential programs required to boot the system, and mount the other partitions, as there wasent enough room on / for the entire OS.
as to add a path, type:
Code:
export PATH=${PATH}:/usr/sbin
Also, youll need to edit your ./.bashrc and add ":/usr/sbin" to the end of the line that declares PATH (so the line looks just like what you would get when you type
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.