- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Where is Path set for SU?
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
Discussions
Discussions
Discussions
Forums
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
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
тАО10-27-2000 09:59 AM
тАО10-27-2000 09:59 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2000 10:06 AM
тАО10-27-2000 10:06 AM
SolutionFrom the man page for 'su':
If you specify the - option of the su command, the new shell starts up as if you just logged in, except as follows:
+ The HOME variable is reset to the new user's home directory.
+ If the new user name is root, the path and prompt variables are reset:
PATH=/usr/bin:/usr/sbin:/sbin
PS1=#
Does this help?
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2000 10:13 AM
тАО10-27-2000 10:13 AM
Re: Where is Path set for SU?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2000 10:15 AM
тАО10-27-2000 10:15 AM
Re: Where is Path set for SU?
There are two types of commands, 1)Internal and 2) External
Internal commands : Itnernal commands are commands which are known to the shell and are part of the shell.
External commands : These commands require an external file (Executables/shellscripts etc.,) to be present at some directory.
Now the question comes how does shell know where it is located ?
The answer is PATH variable.
When it comes to path, generally it will be set in global /etc/profile or /home/greg/.profile, The order of execution of these profiles is /etc/profile -> /home/greg/.profie.
Generally, if path is not set and you fire the command, shell says 'not found'. If you want to find out exactly where a partiuclar executable is located, you can use
# whereis
The output of above command will be the path where the executable is located.
or the find command can be used.
# find / -name
Regarding su command it is located at /usr/bin/su.
Regards,
......Madhu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2000 10:29 AM
тАО10-27-2000 10:29 AM
Re: Where is Path set for SU?
I think you want to 'su' without the '-' flag. Try this:
# echo $PATH
# PATH=$PATH:/tmp #...add /tmp to PATH
# su someuser
# echo $PATH
# exit # back to original
# su - someuser
# echo $PATH
# exit
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2000 12:00 PM
тАО10-27-2000 12:00 PM
Re: Where is Path set for SU?
The same is true for some like root doing an su to oracle. The oracle user may have all sorts of customized tasks and settings run by .profile but they won't be touched without using the - option as in:
/usr/bin/su - oracle
Notice that I did NOT type su? Where did your copy of su come from? Since su without any directory will wander through the $PATH values, it could be /usr/local/bin/su or even /tmp/su, programs put there specifically by a hacker. To see where su will come from, use the whence -v command (ksh, POSIX sh) as in:
whence -v su
So the default $PATH for su is the hacker's environment--except for root where su tries to keep you from getting in trouble. So, to avoid big problems, never type su without the - sign.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2000 12:10 PM
тАО10-27-2000 12:10 PM
Re: Where is Path set for SU?
Thanks for the cautionary note! A really good point!
...JRF...