- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Disable telnet access, but allow cron and su acces...
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
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
09-16-2004 07:50 AM
09-16-2004 07:50 AM
Disable telnet access, but allow cron and su access
How do you disable telnet access for a particular UX account while still allowing local and su access?
I added the following lines to the user's .profile file to prevent telnet logins, but it also prevented cron jobs and su - access:
# no telnet sessions
echo "#####################################"
echo "### sorry, telnet access disabled ###"
echo "#####################################"
exit
Thank you,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2004 08:24 AM
09-16-2004 08:24 AM
Re: Disable telnet access, but allow cron and su access
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2004 08:28 AM
09-16-2004 08:28 AM
Re: Disable telnet access, but allow cron and su access
Do you want to disable the telnet access to a particular user?? If yes, you can lock his account. passwd -l user_name.
You can also put some code in /etc/profile to check if user_name==xx and then deny access.
If user always comes from certain ip, then you can disable the access in /var/adm/inetd.sec file.
For cron jobs, you can make use of /var/adm/cron.allow and /var/adm/cron.deny files. About the use of su, you will have do some coding. Move the su to something else and put a script there. This script will chck which user is doing su and will grant access depening upon the checks you have put.
You may also want to look at /etc/default/security file. man 4 security for details.
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2004 08:29 AM
09-16-2004 08:29 AM
Re: Disable telnet access, but allow cron and su access
I usually do the following way. Create a file called /etc/nodirectlogin with the following syntax
suonly1:First User
suonly2:Second User
Then put the following snippet in /etc/profile and (modify it to suit to csh.login for cshell)
ME=$(who am i|awk '{print $1}')
grep -q "^${ME}:" /etc/nodirectlogin
if [ $? = 0 ]
then
MYNAME=$(grep "^${ME}:" /etc/nodirectlogin|awk '{FS=":";print $2}')
echo "$MYNAME!!! You cannot login directly. Login with your own id and then SU to
$ME"
exit
fi
Here suonly user cannot login directly. But he/she can login as some user and then do an 'su' to suonly. The key is 'who am i' not "whoami".
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2004 08:33 AM
09-16-2004 08:33 AM
Re: Disable telnet access, but allow cron and su access
# no telnet sessions
SHELL=ksh # chage this according to user's default shell
pid=`ps | grep ${SHELL} | grep -v grep | awk {'print $1'}`
ppid=`ppid=`ps -ef | grep ${pid} | grep ${SHELL} | grep -v grep | awk {'print $3'}`
ps -ef | grep ${ppid} | grep telnetd
r=`echo $?`
if [ $r -eq 0 ]
then
echo "#####################################"
echo "### sorry, telnet access disabled ###"
echo "#####################################"
exit
fi
Hope this helps
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2004 08:27 PM
09-16-2004 08:27 PM
Re: Disable telnet access, but allow cron and su access
USER --> telnet disabled user
if [[ "$LOGNAME" = "USER" ]]
then
if [[ $(ps | grep -q 'telnet') -eq 0 ]]
then
# no telnet sessions
echo "#####################################"
echo "### sorry, telnet access disabled ###"
echo "#####################################"
# Sleep to display message and give time to read
sleep 3
exit 1
fi
fi
It will check weather login service is with telnet, if so print the message and exit.
Sleep time will be needed to print the message for 3 seconds, so that user know the reason without exiting at once ;)
Regards
-Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2004 01:02 AM
09-17-2004 01:02 AM
Re: Disable telnet access, but allow cron and su access
mark