- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: restrict user from shell/command prompt in uni...
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-15-2010 03:09 AM
тАО10-15-2010 03:09 AM
restrict user from shell/command prompt in unix
would like to seek your advice. currently these group of users login to the server, they will get one operator menu, but when they control c, it will give them to $ prompt. how to disable this $ prompt at all?
Hope to hear from you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2010 03:41 AM
тАО10-15-2010 03:41 AM
Re: restrict user from shell/command prompt in unix
Apparently these users have the "operator menu" either as their shell or in their .profile.
What is this operator menu?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2010 03:58 AM
тАО10-15-2010 03:58 AM
Re: restrict user from shell/command prompt in unix
Thank you for your reply.
how to control (Ctrl +C) this from OS?
The menu called from its profile. The operator menu does the system health check and run application batches.
Hope to hear from you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2010 04:08 AM
тАО10-15-2010 04:08 AM
Re: restrict user from shell/command prompt in unix
trap "" 2
> disable this $ prompt at all?
The $ pronpt comes from the shell. Apparently, you have changed the operator's login profile to run the operator menu, not ideal at all. The reason is that when the menu program terminates, the parent (shell) returns. Change the startup of the menu program to exec like this:
exec /someDIR/myMenuProgram
The exec command replaces the shell and when the menu program stops, whether normally or because of a signal like SIGINT or SIGHUP, the menu process stops and the user is disconnected.
An even simpler way is to make the program or script the user's login shell. You can change this (as root) at any time using chsh:
chsh oper /someDIR/myMenuProgram
NOTE: If this is a script, it must be properly written and that means line 1 looks like this:
#!/usr/bin/sh
or
#!/usr/bin/ksh
or whatever shell was used to write the menu program.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2010 04:17 AM
тАО10-15-2010 04:17 AM
Re: restrict user from shell/command prompt in unix
> cd /CTCS/batch/script
> operator_menu.sh MYR
There are several problems with this. cd'ing into a directory is never recommended, especially just to run a script without typing the fullpath. It should read:
/CTCS/batch/script/operator_menu.sh MYR
And since this works for you:
operator_menu.sh MYR
rather than:
./operator_menu.sh MYR
your PATH has a serious security issue:
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.
At the very end is the dreaded :. (could be :.: or even ::) which means: search the current working directory for the executable.
SO make sure your script operator_menu.sh starts with:
#!/usr/bin/sh
and I would use chsh to make the shell your menu program. The next line in your script should be:
trap "" 2
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-16-2010 04:45 AM
тАО10-16-2010 04:45 AM
Re: restrict user from shell/command prompt in unix
I would define the operator menu script as the user's default shell. But before the chsh command, you should add the script to the list of valid shell files:
# echo "/CTCS/batch/script/operator_menu.sh" >> /etc/shells
# chsh oper /CTCS/batch/script/operator_menu.sh
Regards,
Viktor
Unix operates with beer.