- Ubuntu版本:24.04 LTS
切换到root用户(可选)
安装系统后,默认root用户不能登录,密码也是空的。
sudo passwd root
然后提示你输入密码和确认密码。切换用户
su - root
安装openssh-server
sudo apt-get install openssh-server
需要编辑一下/etc/ssh/sshd_config文件:
sudo vim /etc/ssh/sshd_config
取消如下参数LoginGraceTime、PermitRootLogin和StrictModes注释,并将PermitRootLogin改为yes:
如下图:
编辑完成,按下Esc,“:wq”保存。之后重启服务即可:
sudo /etc/init.d/ssh restart
检查服务
sudo ps -e | grep ssh
获取IP地址
方式1
ip addr show
方式2:安装net-tools
sudo apt-get install net-tools
查看IP
ifconfig -a
“192.168.0.175”即为所需IP地址
root@vinci:~# ifconfig -a
ens18: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.175 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::be24:11ff:fe44:8604 prefixlen 64 scopeid 0x20<link>
ether bc:24:11:44:86:04 txqueuelen 1000 (Ethernet)
RX packets 1029787 bytes 144779586 (144.7 MB)
RX errors 0 dropped 248403 overruns 0 frame 0
TX packets 3043 bytes 286084 (286.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 539 bytes 58059 (58.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 539 bytes 58059 (58.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
使用MobaXterm连接
下载MobaXterm,打开MobaXterm新建SSH连接