GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Restrict shell to user
Operating System - HP-UX
1844038
Members
2280
Online
110226
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
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
08-31-2006 03:48 AM
08-31-2006 03:48 AM
Restrict shell to user
Hi:
I dont whant the users can use CTRL+D o CRTL+C to cancel a program that they run. rigth now the user made a ctrl+d and they go to unix shell but i need a exit complete when they try to type a crtl + d to break a program.
Some Body have a idea ?
thank alot !!
I dont whant the users can use CTRL+D o CRTL+C to cancel a program that they run. rigth now the user made a ctrl+d and they go to unix shell but i need a exit complete when they try to type a crtl + d to break a program.
Some Body have a idea ?
thank alot !!
The time is gold
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2006 04:00 AM
08-31-2006 04:00 AM
Re: Restrict shell to user
Hi Isaac:
Generally, a CTRL_D signals end-of-file for a read operation. A CTRL_C is a an interrupt signal. In a shell program you use 'trap' do catch and deal with the signal. For instance:
#!/usr/bin/sh
trap 'echo "No way!"' INT
read REPLY
echo ${REPLY}
exit
Regards!
...JRF...
Generally, a CTRL_D signals end-of-file for a read operation. A CTRL_C is a an interrupt signal. In a shell program you use 'trap' do catch and deal with the signal. For instance:
#!/usr/bin/sh
trap 'echo "No way!"' INT
read REPLY
echo ${REPLY}
exit
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2006 06:41 AM
08-31-2006 06:41 AM
Re: Restrict shell to user
Hello Isaac,
There are a couple of alternate solutions you may want to try:
1) Use the â execâ command to execute the user application from the user environment start up. This will still allow the user to CTRL_C or CTRL-D but will not allow them to obtain a shell prompt.
Example:
edit the users $HOME/.profile file (for the bourne/ksh/posix shells) or $HOME/.login (for the Csh) and add the following lines in an appropriate place within the file.
exec ; exit
2) You can substitute the star up shell in the /etc/passwd file for the user with a start up scrip that will ignore signals from the keyboard.
Example:
Start up script for a posix shell:
----------------
#!/usr/bin/sh
export PATH=$PATH: #usually /usr/local/bin
trap â â 1 2 3 15 # this will ignore keyboard signal as well as kill â s TERM
exec exit
-------------------------------
Then edit the /etc/passwd file and change the last field of the userâ s record (i.e /usr/bin/sh) by the full pathname of your start up script. This will create a slave user (slave to the application that is) the upon login in will be presented with the application, attempts to stop the scrip will fail and closing the application by any means will log out the user.
3) You can also use the command â styâ to disable the â suspâ , â intâ and â quitâ signals from being generated via keyboard. That is disable CTRL-D, CTRL-C and CTRL- \
I hope this will help you some how, good luck
There are a couple of alternate solutions you may want to try:
1) Use the â execâ command to execute the user application from the user environment start up. This will still allow the user to CTRL_C or CTRL-D but will not allow them to obtain a shell prompt.
Example:
edit the users $HOME/.profile file (for the bourne/ksh/posix shells) or $HOME/.login (for the Csh) and add the following lines in an appropriate place within the file.
exec
2) You can substitute the star up shell in the /etc/passwd file for the user with a start up scrip that will ignore signals from the keyboard.
Example:
Start up script for a posix shell:
----------------
#!/usr/bin/sh
export PATH=$PATH:
trap â â 1 2 3 15 # this will ignore keyboard signal as well as kill â s TERM
exec
-------------------------------
Then edit the /etc/passwd file and change the last field of the userâ s record (i.e /usr/bin/sh) by the full pathname of your start up script. This will create a slave user (slave to the application that is) the upon login in will be presented with the application, attempts to stop the scrip will fail and closing the application by any means will log out the user.
3) You can also use the command â styâ to disable the â suspâ , â intâ and â quitâ signals from being generated via keyboard. That is disable CTRL-D, CTRL-C and CTRL- \
I hope this will help you some how, good luck
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