赞
踩
通过VMware Workstation安装Ubuntu 20.04.1,默认没有开启SSH和Telnet服务以及端口号,无法通过超级终端进行连接
$apt-get update
$apt-get install iptables
iptables -I INPUT -p tcp --dport 22 -j ACCEPT
iptables -I INPUT -p tcp --dport 23 -j ACCEPT
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -j ACCEPT
$ iptables-save
这样可以开放指定的端口,但是如果服务器重启,不会保存,所以我们需要对上述规则进行一下持续化操作
$ apt-get install iptables-persistent
sudo invoke-rc.d iptables-persistent save
sudo invoke-rc.d iptables-persistent reload
或者
sudo /etc/init.d/iptables-persistent save
sudo /etc/init.d/iptables-persistent reload
$ netfilter-persistent save
$ netfilter-persistent reload
/etc/iptables/rules.v4
/etc/iptables/rules.v6
sudo apt-get update
sudo apt-get install openssh-server
sudo ufw allow ssh
systemctl status ssh
关闭ssh服务
systemctl stop ssh
开启ssh服务
systemctl start ssh
systemctl restart ssh
设置开启自启
sudo systemctl enable ssh
关闭开机自启
sudo systemctl disable ssh
sudo apt-get install openbsd-inetd -y
sudo apt-get install telnetd -y
指令
sudo netstat -a | grep telnet
运行状态
tcp 0 0 0.0.0.0:telnet 0.0.0.0:* LISTEN
root login: pgzxc
Password:
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-52-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
286 updates can be installed immediately.
72 of these updates are security updates.
To see these additional updates run: apt list --upgradable
Your Hardware Enablement Stack (HWE) is supported until April 2025.
Last login: Tue Jan 12 17:10:17 CST 2021 from 192.168.116.1 on pts/1
打开控制面板–>程序–>启用或关闭Windows功能—>Telnet Client
Ubuntu 20.04.1 LTS root login: pgzxc Password: Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-52-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 286 updates can be installed immediately. 72 of these updates are security updates. To see these additional updates run: apt list --upgradable Your Hardware Enablement Stack (HWE) is supported until April 2025. Last login: Tue Jan 12 17:45:24 CST 2021 from localhost on pts/3
重启openbsd-inetd服务
sudo /etc/init.d/openbsd-inetd restart
重启系统
sudo reboot
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。