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 03-29-2013, 01:15 PM   #1
Crimsonlegion
LQ Newbie
 
Registered: Dec 2012
Posts: 2

Rep: Reputation: Disabled
CentOS does not have right path


hello everyone,

as you can tell from my thread title, I am running CentOS as both server and a client machine for college, but I am restricted to using version 5.8 and it does not seem to have the right PATH for regular users to use commands like service, ifconfig,sendmail and commands of that sort. I have to resort to finding the full pathname for the command like /usr/sbin/sendmail in order to get it to work. However when i SU - , to login to root with full attributes, root has access to all those commands without the full path to it.

I am wondering if anyone knows to set the PATH to the proper PATH so I can use these commands and not have to login as root all the time?
 
Old 03-29-2013, 01:20 PM   #2
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
Hi

Post the output
Code:
echo $PATH
as user
 
Old 03-29-2013, 01:23 PM   #3
camorri
LQ 5k Club
 
Registered: Nov 2002
Location: Somewhere inside 9.9 million sq. km. Canada
Distribution: Slackware 15.0, current, slackware-arm-currnet
Posts: 6,213

Rep: Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848
This link -->http://www.troubleshooters.com/linux/prepostpath.htm explains the entire thing.
 
Old 03-29-2013, 01:28 PM   #4
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Simply add following line in user's ~/.bashrc or ~/.profile file:
Code:
export PATH=$PATH:/usr/sbin
Then check the full path as:
Code:
echo $PATH
 
Old 03-29-2013, 01:34 PM   #5
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by Crimsonlegion View Post
hello everyone,

as you can tell from my thread title, I am running CentOS as both server and a client machine for college, but I am restricted to using version 5.8 and it does not seem to have the right PATH for regular users to use commands like service, ifconfig,sendmail and commands of that sort. I have to resort to finding the full pathname for the command like /usr/sbin/sendmail in order to get it to work. However when i SU - , to login to root with full attributes, root has access to all those commands without the full path to it.

I am wondering if anyone knows to set the PATH to the proper PATH so I can use these commands and not have to login as root all the time?
Regular users don't use "service,sendmail and commands of that sort". service in particular is only usable by root. Sendmail is normally used as a daemon, not by users. Users use MUAs, and sendmail is a MTA. Now special case use of sendmail is possible - but only if the user knows how to format mail messages for a MTA. And that is what utilities like mail, mailx are used for.

All you need to do is look in roots profile. Might also check the /etc/profile in case it sets a different one when it is the root user logging in.

A user can set any PATH value they want.
 
Old 03-29-2013, 01:55 PM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by Crimsonlegion View Post
I am wondering if anyone knows to set the PATH to the proper PATH
It already has the "proper" PATH. The programs in /sbin and /usr/sbin are in those directories, and not in your PATH, because they are specifically NOT meant for regular users to run them. They are administrative programs that are meant to be run by root, not regular users.

http://www.linuxquestions.org/questi...vs-sbin-96063/

You can add them to your PATH so that you don't have to use the full path to run them, but most of the things you try to do with those programs will result in "permission denied" errors anyway unless you're running them as root.

Last edited by suicidaleggroll; 03-29-2013 at 01:57 PM.
 
Old 03-29-2013, 02:23 PM   #7
spiky0011
Senior Member
 
Registered: Jan 2011
Location: PLANET-SPIKE
Distribution: /LFS/Debian
Posts: 2,511
Blog Entries: 1

Rep: Reputation: 412Reputation: 412Reputation: 412Reputation: 412Reputation: 412
Hi

That means you would have to add yourself sudoers
 
  


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
eval $PATH produces a path list followed by No such file or directory warning Alpha90 Linux - Newbie 10 11-04-2012 10:16 AM
Path shortcuts in CentOS investmentbnker75 Linux - Server 7 09-15-2010 12:22 PM
CentOS - gcc path question rheng Linux - Newbie 3 07-29-2008 01:13 PM
Cannot correctly set up the PATH environment variable Centos dralexpe Linux - Software 7 05-30-2008 11:23 PM
CentOS 4.4 saving PATH, CLASSPATH variables Thor Red Hat 2 11-25-2006 08:55 AM

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

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