HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: How to write a special shell menu ?
Operating System - Linux
1838068
Members
4754
Online
110124
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
05-06-2005 01:16 AM
05-06-2005 01:16 AM
I have a handheld device which can telnet to our Unix/Linux servers to run an application, it has a full functional keyboard with all keys.
I need to force all users who login to the servers via such device to run a shell script right after they login, without prompting the commandline, like this:
************************
1. Run Application
2. Change Password
3. Logout
************************
I need to restrict all users to access only the options above, they should not be able to do anything else except the actions above.
How to prevent them from using "Ctrl + C" or something else to break the shell and going into the Prompt. That is, they don't need to run "ls", "vi"... It's a security approach.
And how to return back to such menu after users exit the application ?
Thanks!
I need to force all users who login to the servers via such device to run a shell script right after they login, without prompting the commandline, like this:
************************
1. Run Application
2. Change Password
3. Logout
************************
I need to restrict all users to access only the options above, they should not be able to do anything else except the actions above.
How to prevent them from using "Ctrl + C" or something else to break the shell and going into the Prompt. That is, they don't need to run "ls", "vi"... It's a security approach.
And how to return back to such menu after users exit the application ?
Thanks!
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2005 01:27 AM
05-06-2005 01:27 AM
Solution
In the user's profile (.bashrc or .profile or whatever), put commands similar to these:
display_menu() {
clear
echo "*********************"
echo "1. Run Application"
echo "2. Change Password"
echo "3. Logout"
echo "*********************"
}
#
# this disables the ^C interrupt
#
stty intr undef
display_menu
while read LINE
do
case $LINE in
1) /path/to/application
;;
2) passwd
;;
3) exit
;;
*)
echo "Invalid option. Press enter to return to menu."
read JUNK
;;
esac
display_menu
done
Simply put, this will loop forever, taking a value 1, 2 or 3 followed by an Enter. When the application or password change is complete, it'll clear the screen and re-display the menu.
Of course, you can make it as pretty or ugly as you desire, but that's the basics of it.
display_menu() {
clear
echo "*********************"
echo "1. Run Application"
echo "2. Change Password"
echo "3. Logout"
echo "*********************"
}
#
# this disables the ^C interrupt
#
stty intr undef
display_menu
while read LINE
do
case $LINE in
1) /path/to/application
;;
2) passwd
;;
3) exit
;;
*)
echo "Invalid option. Press enter to return to menu."
read JUNK
;;
esac
display_menu
done
Simply put, this will loop forever, taking a value 1, 2 or 3 followed by an Enter. When the application or password change is complete, it'll clear the screen and re-display the menu.
Of course, you can make it as pretty or ugly as you desire, but that's the basics of it.
One long-haired git at your service...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2005 05:20 AM
05-06-2005 05:20 AM
Re: How to write a special shell menu ?
stty is good ! thanks !
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP