ubuntu配置SSH登录xsheel

发布时间 2023-10-28 18:02:26作者: tlocd

ubuntu配置SSH登录xsheel

  • 环境

    Ubuntu-22.04.2-desktop-amd64

Ubuntu 安装后自带 SSH客户端,但是要想使用 xsheel 连接 Ubuntu 需要在 Ubuntu 中下载SSH-Server。

步骤

安装 openssh-server

sudo apt-get install openssh-server 
# 然后输入密码,填写Y

image-20230906124342379

然后,需要通过编辑 /etc/ssh 目录中的 sshd_config 文件来配置它。

  1. 首先,通过将 sshd_config 文件复制到主目录来备份它,或者通过执行以下操作在 /etc/ssh 中创建只读副本:(在 /etc/ssh 中创建只读备份意味着之后再出现配置有问题是可以回退。)

    sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults
    
    sudo chmod a-w /etc/ssh/sshd_config.factory-defaults
    

    image-20230906124458280

  2. 安装完成,SSH 服务将会被自动启动。你可以验证 SSH 是否正在运行,输入:

``` shell
sudo systemctl status ssh
```

![image-20230906125815354](https://raw.githubusercontent.com/tlocd/image/main/img/202309061258302.png)



按q返回命令行。
  1. Ubuntu 自带一个配置防火墙配置工具,称为 UFW。如果防火墙在你的系统上被启用,请确保打开了 SSH 端口:

    sudo ufw allow ssh