- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Users at command prompt - argh !!
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
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
тАО09-09-2005 12:59 AM
тАО09-09-2005 12:59 AM
Users at command prompt - argh !!
I've written a menu system that I want users of a group 'ops' to be presented with when they login. However, with the command below in /etc/profile, when they logout, it takes them out to a command prompt. How can I get it to automatically log them out when they decide to exit the opsmenu MAIN module.
Cheers
id | grep "gid=.*(ops)" 1>/dev/null 2>&1 && su - root -c "/usr/local/bin/ops/opsmenu MAIN "
Cheers again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-09-2005 01:12 AM
тАО09-09-2005 01:12 AM
Re: Users at command prompt - argh !!
exit "some_code"
you can use some_code to some further testing if you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-09-2005 01:19 AM
тАО09-09-2005 01:19 AM
Re: Users at command prompt - argh !!
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-09-2005 01:23 AM
тАО09-09-2005 01:23 AM
Re: Users at command prompt - argh !!
If you are going to take this approach, at the very least, disable user terminal interrupts in your "opsmenu" script so that a user cannot easily become root.
trap '' 1 2 3 #...HUP, INT, QUIT
Be aware, if you are not, that including any command like 'more', or 'elm' that offers the ability to "shell-out" will enable a user to become root. Caveat emptor!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-09-2005 01:36 AM
тАО09-09-2005 01:36 AM
Re: Users at command prompt - argh !!
exit 0
to bottom of the user's .profile
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-09-2005 03:26 AM
тАО09-09-2005 03:26 AM
Re: Users at command prompt - argh !!
#!/usr/bin/sh
Then you can either edit the passwd file and replace /usr/bin/sh with your script name (cumbersome and error-prone), or use the obscure command chsh as in:
chsh billh /usr/local/bin/ops/opsmenu
Since you can't put a parameter for a shell program in the passwd file, you'll need to wrapper the opsmenu with a specific option:
(a menu script called opsmenuMAIN)
#!/usr/bin/sh
set -u
PATH=/usr/bin
/usr/local/bin/ops/opsmenu MAIN
exit 0
I would not use su -c for the menu program at all. Instead, install sudo and then use it (only) in front of commands that require root privileges. sudo can limit the options allowed for a given command if needed. And sudo can log everything that the users type in.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2005 08:15 AM
тАО09-11-2005 08:15 AM
Re: Users at command prompt - argh !!
Cheers
Steven
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2005 02:32 AM
тАО09-12-2005 02:32 AM
Re: Users at command prompt - argh !!
When you execute your menu script, just put an 'exec' in front of it, as in:
exec /usr/local/bin/ops/opsmenu
This will replace the current shell with a new one, and will log out on exit.
Regards,
Mark
P.S. Are you sure they need to su to root? Sounds kind of dangerous to me...
Just my 2cts.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2005 03:32 AM
тАО09-12-2005 03:32 AM
Re: Users at command prompt - argh !!
exec /path/to/the/script.sh
When the script ends it will logout from the sh session.
good luck