Re: Set PATH Variable for all user (217 Views)
Reply
Regular Advisor
shikhar_1
Posts: 182
Registered: ‎11-18-2010
Message 1 of 10 (217 Views)
Accepted Solution

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.
Please use plain text.
Acclaimed Contributor
Torsten.
Posts: 23,212
Registered: ‎10-02-2001
Message 2 of 10 (217 Views)

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! star in the left column!   
Please use plain text.
Regular Advisor
shikhar_1
Posts: 182
Registered: ‎11-18-2010
Message 3 of 10 (217 Views)

Re: Set PATH Variable for all user

How to set path so that swlist working without specifying /usr/sbin/swlist?
Please use plain text.
Regular Advisor
shikhar_1
Posts: 182
Registered: ‎11-18-2010
Message 4 of 10 (217 Views)

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)
Please use plain text.
Acclaimed Contributor
Torsten.
Posts: 23,212
Registered: ‎10-02-2001
Message 5 of 10 (217 Views)

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! star in the left column!   
Please use plain text.
Regular Advisor
shikhar_1
Posts: 182
Registered: ‎11-18-2010
Message 6 of 10 (217 Views)

Re: Set PATH Variable for all user

What to add in the users profile?
Please use plain text.
Acclaimed Contributor
Torsten.
Posts: 23,212
Registered: ‎10-02-2001
Message 7 of 10 (217 Views)

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! star in the left column!   
Please use plain text.
Regular Advisor
shikhar_1
Posts: 182
Registered: ‎11-18-2010
Message 8 of 10 (217 Views)

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?
Please use plain text.
Acclaimed Contributor
Torsten.
Posts: 23,212
Registered: ‎10-02-2001
Message 9 of 10 (217 Views)

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! star in the left column!   
Please use plain text.
Honored Contributor
Viktor Balogh
Posts: 1,007
Registered: ‎03-15-2009
Message 10 of 10 (217 Views)

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.
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation