- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Forcing the use of the "-" option with 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
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
04-15-2004 06:12 AM
04-15-2004 06:12 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2004 06:16 AM
04-15-2004 06:16 AM
Re: Forcing the use of the "-" option with su
Sure - I can think of two ways:
1) Set up su - as an alias for su in the /etc/profile file or all user's .profile files.
2)Wrap su with a simple script that forces su -
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2004 06:17 AM
04-15-2004 06:17 AM
Re: Forcing the use of the "-" option with su
1) Do a system-wide alias and alias su to 'su -'.
2) move su to su.orig and write a wrapper script called su. In that script you can check and if the first parameter is not a '-' then you can either display an error message, or go ahead and force the use of 'su -' from within the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2004 06:20 AM
04-15-2004 06:20 AM
Re: Forcing the use of the "-" option with su
NO, I did not read Jeff's response before posting mine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2004 06:24 AM
04-15-2004 06:24 AM
Solution1) create an su wrapper script, for su. and ensure that PATH variable is setup correctly, to use your wrapper instead of su. I would not recommend replacing su with a script that calls your renamed su command as patches may replace su in the future.
2) create an alias in /etc/profile for su
to do what you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2004 06:47 AM
04-15-2004 06:47 AM
Re: Forcing the use of the "-" option with su
And on reflection I think the wrapper is going to be the better solution because if you use the alias & somebody *does* use the dash you'll end up with 2 dashes & an error message.
So I would write the wrapper such that it determines the argument count & if it's 2 then examine $1 & if it's a dash let it through untouched. If the count is 1 and it's a user name then add the dash & issue that command. If it's 1 and it's a dash then that's probably an su up to root & you'd let that go through as well. All in all still not very complex.
My 2 cents,
Jeff