- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script for creating User / Operator Menu ??
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
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
07-26-2002 10:32 PM
07-26-2002 10:32 PM
I am thinking to write a menu with either ksh or sh script for the users and operator to use. I am thinking of the security issue right now, how can I restrict them from getting out of the menu ?? Since each menu page options will call other sub-scripts to perform specific functions, what action should I take in order to restrict the users from jump out the shell all the way ??
Appreciated it if anyone can give me some examples.
Thanks,
Chris,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2002 11:03 PM
07-26-2002 11:03 PM
Re: Script for creating User / Operator Menu ??
trap "" 1 2 3
tells the shell to ignore those signals
when you are done
trap - 1 2 3
resets the signal handling to its original value.
It's up to you to decide which signals you are going to ignore.
Remember, there might be a legitimate reason to use an interrupt (usually ctrl-c) in a shell script or an executable so know what you want to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2002 11:51 PM
07-26-2002 11:51 PM
Re: Script for creating User / Operator Menu ??
But here I don't think it's good enough to use
trap "" 1 2 3
because sometimes users really want to use "Ctrl+C" to terminate there session.
Maybe
trap "prompt_script" 1 2 3 is better. For example , when users press ^C, your system will give a message "Terminate your job?" and prompt-for yes/no.
If "yes" ,do break function and the user can really terminate there job; if "no" ,do a initial menu function! Thus the users can't exit from the menu.
-Gerald-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2002 12:34 AM
07-27-2002 12:34 AM
Re: Script for creating User / Operator Menu ??
When the users login , they will land at the menu , they should not get the shell prompt at any circumstances. If this is the requirement
then edit the .profile file in home directories of those users and put
this line.
exec /menu/yourmenuscript
Now users will land at the menu when they log in and if they play tricks like ctrl - c etc
they will be logged out of the system.
regards,
U.SivaKumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2002 01:14 AM
07-27-2002 01:14 AM
Re: Script for creating User / Operator Menu ??
Thanks for the information !! BTW, just want to know what is the meaning of the 1 2 3 for the trape command ?? Any other numbers ?? What they represent ?? Any resources link that help me to master the trap function ??
Many thanks,
Chris,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2002 01:27 AM
07-27-2002 01:27 AM
Re: Script for creating User / Operator Menu ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2002 01:29 AM
07-27-2002 01:29 AM
SolutionUnix provides a mechanism known as signals to inform a process of some event which it may be interested in and wish to deal with or respond to. The shell also generates certain events that a shell programmer may wish to have the shell repond to. Both of these types of events are handled in the shell by a mechanism known as Traps.
Shell procedures can use the trap command to disable a signal or redefine its action. The format of the trap command is,
trap arg signal-list
Arg is a string to be interpreted as a command list and signal-list consists of one or more signal numbers as described by the signal keyword.
Number Signal
0 exit from shell
1 HANGUP
2 INTERRUPT character (DELETE or RUB OUT)
3 QUIT (ctrl-\)
9 KILL (cannot be caught or ignored)
11 segmentation violation
15 software termination signal
regards,
U.SivaKumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2002 01:31 AM
07-27-2002 01:31 AM
Re: Script for creating User / Operator Menu ??
intr and quit keys to undefined
e.g. stty intr '^_' # undefines the intr signal (2)
stty quit '^_' # undefs the quit signal (3)
Of course, you should first save the original values by calling stty and restore them when you need to.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2002 01:37 AM
07-27-2002 01:37 AM
Re: Script for creating User / Operator Menu ??
Look at this link for examples of how trap command is used.
http://www.ualberta.ca/HELP/unix/scrpt_scrpt2.9.3.html#scrpt2.9.3
regards,
U.SivaKumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2002 10:45 AM
07-28-2002 10:45 AM
Re: Script for creating User / Operator Menu ??
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 02:04 AM
07-29-2002 02:04 AM
Re: Script for creating User / Operator Menu ??
As a lot of things you might want ops to do may require root access so instigate sudo (a search on the forum for sudo should locate the Liverpool archive for this) and fire up all menu options via sudo.
Also has the advantage that the options would only be accessible by entering a password each time the option is selected so if they leave their login active no one else can run the options whilst they are not looking.
Attached is the ops menu I setup if you want any ideas. It also includes an option to be displayed for "advanced" users only which is determined by the users access to a specific user group called "rootusers"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 02:06 AM
07-29-2002 02:06 AM
Re: Script for creating User / Operator Menu ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 05:17 AM
07-29-2002 05:17 AM
Re: Script for creating User / Operator Menu ??
Here is a nice script I found somewhere which I use intensively. Nice headers etc.
What is important is to place the same trap commands in the user's .profile also!
Enjoy
Carlo