新聞中心
建站服務(wù)器
配置telnet
通過配置文件,我們可以設(shè)置telnet的連接時間、連接數(shù)、連接ip等,實現(xiàn)更加安全的連接
1 、設(shè)置連接時間,參數(shù)“access_times”
[root@localhost wj]#
gedit /etc/xinetd.d/telnet
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
access_times = 08:00-09:00 13:00-15:00 //
規(guī)定允許連接的時間段
8~9
點,
13~15
點
}
[root@localhost wj]#
service xinetd restart //
重啟服務(wù)
停止
xinetd
:
[
確定
]
正在啟動
xinetd
:
[
確定
]
[root@localhost wj]#
telnet 192.168.0.119 //
嘗試連接
Trying 192.168.0.119...
Connected to 192.168.0.119.
Escape character is '^]'.
Connection closed by foreign host. //
連接失敗
2 、設(shè)置連接數(shù),通過參數(shù)“instances”可以設(shè)置允許的連接數(shù),超過之后就無法再連接了
[root@localhost wj]#
gedit /etc/xinetd.d/telnet
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
instances = 1 //
這里設(shè)置只允許一個連接,第二個就無法連接了
}
[root@localhost wj]#
service xinetd restart //
重啟服務(wù)
停止
xinetd
:
[
確定
]
正在啟動
xinetd
:
[
確定
]
[root@localhost wj]#
telnet 192.168.0.119 //
第一個連接
Connected to 192.168.0.119.
login: david
Password:
Last login: Thu Aug 16 09:10:22 from 192.168.0.119
already login //
成功
[root@localhost wj]#
telnet 192.168.0.119 //
第二個連接
Connected to 192.168.0.119.
Connection closed by foreign host. //
失敗
3 、允許/禁止特定的ip或者網(wǎng)段登錄,參數(shù)“only-from”“no_access”
[root@localhost wj]#
gedit /etc/xinetd.d/telnet
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
only_from = 192.168.0.113 //
只允許
113
連接
# only_from = 192.168.0.0/24 //
允許
1~254
連接
# only_from = 192.168.0.100-192.168.0.200 //
允許
100~200
連接
# only_from = 192.168.0. //
允許
113
和
114
連接
# no_access = 192.168.0.113 //
禁止
113
連接,其他寫法同上
}
4 、允許root連接。只要將文件“/etc/securetty”刪除,那么系統(tǒng)讀不到這個文件,自然就會永續(xù)root登錄
[root@localhost wj]#
mv /etc/securetty /etc/securetty.bak //
重命名該文件
[root@localhost wj]#
service xinetd restart //
重啟服務(wù)
停止
xinetd
:
[
確定
]
正在啟動
xinetd
:
[
確定
]
[root@localhost wj]#
telnet 192.168.0.119 //
連接
Trying 192.168.0.119...
Connected to 192.168.0.119.
login: root //
使用
root
用戶連接
Password:
Last login: Thu Aug 16 07:51:45 from 192.168.0.119
already login
//
連接成功
做了一個Linux學習的平臺,目前出來一個個形,各位可以參考使用
鏈接:
https
://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ密碼:n7bk
網(wǎng)頁標題:Linux服務(wù)器---配置telnet
當前鏈接:http://www.dlmjj.cn/article/chcdid.html