Operating System - HP-UX
1836444 Members
2242 Online
110100 Solutions
New Discussion

Re: I have junk in my path , where did it come from??

 
SOLVED
Go to solution
VERN HARRISON
Occasional Advisor

I have junk in my path , where did it come from??

Notice the occurrence of // in the path.
> echo $PATH
.:/oracle/product/9.2.0.1.0/bin:/usr/bin:
/opt/ansic/bin:/usr/ccs/bin:/usr/contrib/bin:
/opt/mx/bin:/opt/hparray/bin:
/opt/nettladm/bin:/opt/upgrade/bin:
/opt/fcms/bin:/opt/pd/bin:/opt/resmon/bin:
/opt/ignite/bin:/usr/bin/X11:
/usr/contrib/bin/X11:/opt/graphics/common/bin:
/opt/scr/bin:/opt/netscape://opt/perl/bin:
/usr/sbin/diag/contrib:/opt/langtools/bin:
/opt/imake/bin:/opt/perf/bin:
/opt/sanmgr/commandview/client/sbin:
/opt/networker/bin:/opt/hpnpl//bin:
/usr/local/bin:/U01/local/SAS_8.2:/usr/lib:.

I cant tell who is sticking this in my PATH variable. I cant see /etc/profile nor /home/user/.profile doing it. Any thoughts?
3 REPLIES 3
Pete Randall
Outstanding Contributor

Re: I have junk in my path , where did it come from??

Vernon,

While it may seem unlikely, I would triple check /etc/profile, /etc/PATH (which is most likely sourced in /etc/profile) and your ~/.profile file(s). It looks to me like someone fatfingered a forward slash is all.


Pete

Pete
VERN HARRISON
Occasional Advisor

Re: I have junk in my path , where did it come from??

Right. I found it in the /etc/PATH file. Thanks.
Bill Hassell
Honored Contributor
Solution

Re: I have junk in my path , where did it come from??

/etc/PATH is the recommended way to keep a single location for setting the PATH variable. That way, different shells can all source a single location for the PATH setting. This is standard procedure to HP-UX and most HP-UX-aware applications put an entry in /etc/PATH during installation.

There is good new and bad news for this standard. The good news is that applications that expect executables to be found using $PATH will likely run without any adjustments (like creating symlinks or modifyinga bunch of .profiles, etc). The bad news is that $PATH gets extra long so searches can take a bit of time (although most of the PATH is usually cached) and it is hard to read when checking security. $PATH can be aecurity risk if it contains :: or :.: or if any of the directories are world-writable (Trojan horse attacks). It's also hard to see duplicates and non-existant locations.

Be careful about removing some of the PATH elements. Some applications may fail to run or run incorrectly. I personally think that all scripts and applications define their own PATH and never rely on whatever the sysadmin or user has created.


Bill Hassell, sysadmin