- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: login shell
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
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
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-05-2008 08:35 AM
тАО09-05-2008 08:35 AM
login shell
I am writing trying to write a shell script that will given a user menu options. The issue is that when I put exit the user comes back to the shell promt. I need that when he uses the exit option he should be completely logged off from the system.
Kindly advice on what how the account should be created or a sample script will be greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2008 08:38 AM
тАО09-05-2008 08:38 AM
Re: login shell
1) use the script as the shell in /etc/passwd
2) in the profile start the script with exec /scriptname
(if you use the profile option and the user has ftp access then they can simply replace the profile to circumvent the existing one.)
The shell in the password file is more secure.
(script must start with #!/usr/bin/ksh (or sh).
Do not forget to set the traps as well ( trap 1 2 3 ...)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2008 08:46 AM
тАО09-05-2008 08:46 AM
Re: login shell
Does the script need to be listed in /etc/shells if you're going to put it in the password file?
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2008 08:52 AM
тАО09-05-2008 08:52 AM
Re: login shell
> Pete: Does the script need to be listed in /etc/shells if you're going to put it in the password file?
No, it doesn't.
Substituting the menu-based script for the normal login shell prevents smart users who might have a 'more' pipeline in the menu from shelling-out with a bang (!) into a real shell, circumventing the menu. Hence, of the techniques Tim mentioned, this is my preference.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2008 09:04 AM
тАО09-05-2008 09:04 AM
Re: login shell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2008 09:10 AM
тАО09-05-2008 09:10 AM
Re: login shell
/etc/passwd entry.
user1:*:1000:200::/home/user1:/user/local/bin/menu.ksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2008 09:11 AM
тАО09-05-2008 09:11 AM
Re: login shell
change
user1:*:1000:200::/home/user1:/user/local/bin/menu.ksh
to
user1:*:1000:200::/home/user1:/usr/local/bin/menu.ksh
you get the idea.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2008 09:11 AM
тАО09-05-2008 09:11 AM
Re: login shell
In /etc/passwd? Something like this:
user_nam:encrypted_password:101:101::/home/user_name:full_path_name_of_script
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2008 09:16 AM
тАО09-05-2008 09:16 AM
Re: login shell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2008 10:19 AM
тАО09-05-2008 10:19 AM
Re: login shell
As JRF said, no. login doesn't look at shells(4), only ftp and a few others.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-05-2008 03:12 PM
тАО09-05-2008 03:12 PM
Re: login shell
#!/usr/bin/ksh
Or if you use the POSIX shell: #!/usr/bin/sh
And of course the script must be executable by all the users, typically 755 (never 777) permissions.
What will happen at login is that the menu script will be run and any attempt to exit the script returns to another login request. Make sure your script does not provide a menu item for vi or other program that allows the user to call a shell (using the ! character). Just to be sure, you can set the SHELL variable in your script:
export SHELL=/usr/bin/false
Bill Hassell, sysadmin