- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: scripting help...please
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
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
тАО01-13-2005 09:54 AM
тАО01-13-2005 09:54 AM
My aim is to restrict login via startup script. This is what I have written into the /etc/profile:
if [ -r /etc/maintenance_mode ]
then
if [ $LOGNAME != root ]
echo " System down for maint "
then
exit 1
fi
fi
This is supposed to let only root login, and no other users (when attempting logging in with posix/bourne sh, but this is actually stopping ALL users including root from logging in.
Anyone see where I am going wrong. Help much appreciated and lotsa points floating around.
thanks heaps
Maria
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-13-2005 09:58 AM
тАО01-13-2005 09:58 AM
Re: scripting help...please
Try this,
if [ -f /etc/maintenance_mode ]
then
if [ "$LOGNAME" != "root" ]
echo " System down for maint "
then
exit 1
fi
fi
hope this helps.
regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-13-2005 10:05 AM
тАО01-13-2005 10:05 AM
SolutionNOLOGIN=1
Now, when the file /etc/nologin exists only root can login; all other users receive a message from login that they are not allowed to login.
When maintenance mode is finished, simply remove or rename /etc/nologin. You don't need to do any scripting because login will handle it for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-13-2005 10:07 AM
тАО01-13-2005 10:07 AM
Re: scripting help...please
Sorry about the previous post.
try this,
if [ -f /etc/maintenance_mode ]
then
if [ "$LOGNAME" != "root" ]
then
echo " System down for maint "
exit 1
fi
fi
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-13-2005 10:09 AM
тАО01-13-2005 10:09 AM
Re: scripting help...please
thanks for quick reply.Unfortuneately I get exactly the same result....any more suggestions???
thanks, Maria
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-13-2005 10:29 AM
тАО01-13-2005 10:29 AM
Re: scripting help...please
if [ $LOGNAME != root ]
echo " System down for maint "
then
You should have this instead-
if [ $LOGNAME != root ]
then
echo " System down for maint "
"then" should be right after the "if"
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-13-2005 10:51 AM
тАО01-13-2005 10:51 AM
Re: scripting help...please
I have tested both methods, and they are working for us.
with the /etc/profile script I had to also put the spaces between the [ and " , then all worked ok.
Thanks Clay, for the nologin info - this appears to be the way to go for notifying ( and kicking off) all types of shell users.
Maria.