Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

Set PATH Variable for all user

SOLVED
Go to Solution
Highlighted
Regular Advisor

Set PATH Variable for all user

Hi,

I am getting following errors while executing server:swlist
/sbin/sh: swlist: not found.

But
whereis swlist
swlist: /usr/sbin/swlist

How to set my path variable to /usr/sbin/swlist for all users.

Please reply ASAP.
9 REPLIES
Acclaimed Contributor Acclaimed Contributor

Re: Set PATH Variable for all user

Normally the commands in /usr/sbin are for root, not for users.

However, /etc/PATH has the paths.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Regular Advisor

Re: Set PATH Variable for all user

How to set path so that swlist working without specifying /usr/sbin/swlist?
Regular Advisor

Re: Set PATH Variable for all user

Even root user is not able to execute it without specify /usr/sbin before the command(/usr/sbin/swlist)
Acclaimed Contributor Acclaimed Contributor

Re: Set PATH Variable for all user

If you don't want to change /etc/PATH, you should consider to add this to the users profile.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Regular Advisor

Re: Set PATH Variable for all user

What to add in the users profile?
Acclaimed Contributor Acclaimed Contributor

Re: Set PATH Variable for all user

You are an expert in this area, right?

Add /usr/sbin to the PATH definition in root's profile.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Regular Advisor

Re: Set PATH Variable for all user

Through command also we can do i believe

PATH=/usr/sbin:$PATH:/sbin:/home/root
export PATH

Is it ok?
Acclaimed Contributor Acclaimed Contributor

Re: Set PATH Variable for all user

Yes, but it works for the current session only.

Next time you log on you have to do it again.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Honored Contributor Honored Contributor

Re: Set PATH Variable for all user

shikhar,

you need to edit the profile of the root user to add it:

# vi ~/.profile

and insert /usr/sbin the following to the PATH variable

I wouldn't add it directly to /etc/PATH, because /usr/sbin contains commands which are for the root user. (see Thorsten's reply above)

Regards,
Viktor
****
Unix operates with beer.