- 论坛徽章:
- 1
|
如何禁止用户telnet,只能进行ftp?
写一段程序放入文件用户目录下.profile中
- TY=`tty|cut -b 9-12`
- WH=`finger|cut -b 32-79|grep "$TY"|cut -b 29-39`
- KK=`tty|cut -b 6-9`
- if [ "$KK" = "ttyp" ]
- then
- WH=$WH
- else
- WH="local"
- fi
- trap 1 2 3 9 15
- if [ "$WH" = "local" -o "$WH" = "用户名" ]
- then
-
- SHELL=/bin/sh
- HOME=/
- PATH=/bin:/etc:/usr/bin:/tcb/bin:/zy
- # set terminal type
- eval `tset -m scoansi:${TERM:-scoansi} -m :\?${TERM:-scoansi} -e -r -s -Q`
- export TERM PATH SHELL HOME
- [ -x /bin/mesg ] && mesg n # if mesg is installed...
- date
- else
- echo "you can not telnet by root:\07\07" #拒绝登录并响铃告警
- echo "press any key to exit"#按任意键退出
- read sad
- exit
- fi
复制代码 |
|