Ubuntu 23.0 使用root用户登录;开启ssh远程登录,sftp传输文件;
设置root用户密码
sudo passwd root
ifconfig查看ip,安装 net-tools
apt install update
apt install net-tools
安装vim
apt install vim
安装SSH
apt install openssh-server
启动SSH
systemctl start ssh
或者
service ssh start
设置SSH开机自启
systemctl enable ssh
查看SSH状态
service ssh status
或者
systemctl status ssh
防火墙允许通过22端口
ufw allow 22
开启ssh远程登录~授权~ 修改 vim /etc/ssh/sshd_config ,将PermitRootLogin选项,去掉井号并改为yes
重启SSH 服务
systemctl restart ssh
尝试远程ssh连接
开启远程SFTP
进入 /etc/ssh/sshd_config ,查看下面这些配置是否存在; 没有的话就加进去
Subsystem sftp internal-sftp Match group sftp ChrootDirectory %h ForceCommand internal-sftp AllowTcpForwarding no
重启SSH 服务
systemctl restart ssh