修改ssh配置文件
> cd /etc/ssh
> cat sshd_config
- 修改配置文件
> vim sshd_config
配置文件修改项如下:
#修改端口
Port 2222
#打开本地监听
ListenAddress 0.0.0.0
#允许密码登陆
PasswordAuthentication yes
#允许root登录
PermitRootLogin yes
重启ssh
> sudo service ssh restart
- 可能会遇到错误:报“Could not load host key”错
- 解决方法:重新生成host key
> sudo dpkg-reconfigure openssh-server