- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: add current directory (.) to the path
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 04:41 PM
02-08-2002 04:41 PM
I tried to add . (current directory) to the path (root account) on a hp workstation that is only connected to interior network, but there was no success.
The files that I modified are /.profile,
/etc/profile and /etc/PATH. What is the
right way to do it?
Best regards,
Reggie
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 06:16 PM
02-08-2002 06:16 PM
SolutionAdding PATH /.profile applies
to your own shell.
But Adding PATH /etc/profile
applies to system wide shell.
PATH=$PATH:.
I tried to add . (current directory) to the path (root account) on a hp workstation that is only connected to interior network, but there was no success.
The files that I modified are /.profile,
/etc/profile and /etc/PATH. What is the
right way to do it?
Best regards,
Reggie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 08:04 PM
02-08-2002 08:04 PM
Re: add current directory (.) to the path
In your root's .profile, specify
export PATH=$PATH:.
Note that for security concerns, adding the current directory to PATH is usually not recommended. If it is really necessary, add it right at the end of your PATH so that system directories take precedence over the current directory.
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2002 09:53 PM
02-08-2002 09:53 PM
Re: add current directory (.) to the path
Add this line to your .profile,
export PATH=$PATH:.
This will allow the current directory to be search last. If you want the current directory to be searched first, do this,
export PATH=.:$PATH
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2002 05:37 AM
02-09-2002 05:37 AM
Re: add current directory (.) to the path
the *right* way is NOT to do this!
Add all the directories containing codefiles you need into "/etc/PATH" (must be a SINGLE line of text), and "~root/.profile", but never-ever the working directory!!!
Reason?
Just imagine somebody calling for your help with a file in "/tmp" - that happens, right?
Now that user had prepared some executables in "/tmp", like "mroe", "dir", "l", "cd.." or such - and as soon as you make that kind of typing mistake you are executing the attackers code :-(
Beware of that!
Wodisc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2002 08:59 AM
02-09-2002 08:59 AM
Re: add current directory (.) to the path
DTSOURCEPROFILE=true
will help but it still isn't a 'normal' Unix login.
So for starting terminal windows like dttrem or hpterm or even xterm using the CDE desktop, and you want normal Unix behavior, create an .Xdefaults file with something like this:
*loginShell: true
HPterm*background: navy
HPterm*foreground: white
Xterm*background: darkslateblue
Xterm*foreground: white
The *loginShell will cause the terminal emulators to 'really' login and use /etc/profile and .profile. You can change the default colors (and dozens of other decoration config and setting) in .Xdefaults. See the man page for each terminal emulator.
ANd after all that, the previous comments about adding . to your $PATH are quite valid. Someday, you'll cd into an unsafe directory, type an important command like su and giveaway your password to a hacker (do you know where your su came from?). So to execute a command or script in the current directory, you type two (only 2) extra leading characters: ./
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2002 09:43 AM
02-09-2002 09:43 AM
Re: add current directory (.) to the path
Bill Hassell hit it right on the head, follow his suggestions IF you want to continue, BECAUSE Wodisch makes a great case against NOT adding the current directory to your path list! And I totally agree with Wodisch. if it's because someone is TOO LAZY to type in "./" before a command in their current directory, then I say screw them! Besides it's ridiculous and a security violation to allow any user access to any shell!
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2002 04:25 PM
02-09-2002 04:25 PM
Re: add current directory (.) to the path
With regards to disallowing users in running any shell, you can make use of restricted sam to create a menu-like system:
# sam -r
In your /etc/profile, have statements that says:
========================================
trap "" 1 2 3
# your statement here
if [ "$LOGNAME" != "root" ]
then
/usr/sbin/sam -r
logout
fi
trap 1 2 3
========================================
Hope this helps. Regards.
Steven Sim Kok Leong