LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 02-07-2007, 05:22 PM   #1
taigon
LQ Newbie
 
Registered: Mar 2006
Posts: 28

Rep: Reputation: 15
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 ./
 
Old 02-07-2007, 05:27 PM   #2
fukawi2
Member
 
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 449

Rep: Reputation: 34
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:
Code:
ln -s /usr/sbin/sendmail /usr/bin/sendmail
 
Old 02-07-2007, 05:54 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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.
 
Old 02-07-2007, 06:00 PM   #4
fukawi2
Member
 
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 449

Rep: Reputation: 34
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...?
 
Old 02-07-2007, 06:10 PM   #5
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
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.
 
Old 02-08-2007, 12:46 AM   #6
taigon
LQ Newbie
 
Registered: Mar 2006
Posts: 28

Original Poster
Rep: Reputation: 15
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?
 
Old 02-08-2007, 01:01 AM   #7
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
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
Code:
env | grep PATH
 
Old 02-08-2007, 01:05 AM   #8
fukawi2
Member
 
Registered: Oct 2006
Location: Melbourne, Australia
Distribution: ArchLinux, ArchServer, Fedora, CentOS
Posts: 449

Rep: Reputation: 34
Something like:

Code:
PATH=$PATH:/usr/sbin
export PATH
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
making files available in /usr/local/bin and /usr/sbin reakinator Linux - Newbie 1 10-14-2006 05:09 PM
Starting httpd: /usr/sbin/httpd: symbol lookup error: /usr/local/lib/libaprutil-0.so. bijuhpd Linux - Newbie 1 10-30-2005 05:07 PM
/usr/sbin and /sbin world read/executable... why? lazlow69 Slackware 3 04-29-2004 05:06 PM
As root, not seeing /sbin and /usr/sbin in path weghman Linux - Newbie 3 04-25-2004 01:06 PM
/sbin vs /usr/sbin !?!?!? different? sirpelidor Red Hat 1 10-24-2003 03:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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