安裝 ssh server
sudo apt-get install openssh-server
設定檔: /etc/ssh/sshd_config
重新啟動 ssh:
sudo service ssh restart
安裝 telnet server
sudo apt install xinetd telnetd
編輯 /etc/xinetd.conf,在 defaults 裡面加入成為:
defaults
{
# Please note that you need a log_type line to be able to use log_on_su$
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}
如果要修改 telnet 的連接埠 (預設是 23),修改 /etc/services
telnet 23/tcp
還有更多設定……
編輯 /etc/xinetd.d/telnet,加上這幾行
# default: on
# description: The telnet server serves telnet sessions; it uses
# unencrypted username/password pairs for authentication.
service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
甚至可以再加上這幾行
only_from = 192.168.0.100 #只允許192.168.0.100 IP 登入
only_from = 192.168.120.0/24 #限制只有 192.168.120.x 網段可以登入
only_from = .bob.com #只允許來自 bob.com 網域登入
no_access = 192.168.120.{101,105} #不允許這 2 個 IP 登入
access_times = 8:00-9:00 20:00-21:00 #只允許這 2 個時段登入
......
重新啟動 telnet service:
sudo /etc/init.d/xinetd restart
或
sudo service xinetd restart
ref:
• 【Linux】在 Ubuntu 上安裝 SSH Server
• [Ubuntu] 安裝 Telnet server 及 SSH server
#linux #telnet