1.安装ssh服务
apt install ssh

2.进入/etc/ssh/修改sshd_config配置文件,让其可以root权限登陆该服务器
nano /etc/ssh/sshd_config

Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:


LoginGraceTime 120m
#PermitRootLogin prohibit-password
PermitRootLogin yes
StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

3.重启ssh服务
service ssh restart
service sshd restart