1、查看ubuntu系统版本
root@UbuntuTian:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
Realase这一栏是系统版本
网上搜一下这个版本的国内源
2、更新源(示例:22.04版本)
vi /etc/apt/sources.list
删掉全部的,把刚才搜到对应版本源的写进去。
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse
3、更新好后更新一下 apt(可能需要更新一段时间)
apt-get update
4、安装ssh服务
apt-get install ssh
5、配置sshd-config文件
vim /etc/ssh/sshd_config
找到Authentication 这栏
设置成如下内容(记得把#去掉,才生效)
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
6、开启ssh服务
systmectl start ssh
如下,就可以连接xshell了
Connecting to *.*.*.*:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Welcome to Ubuntu 22.04 LTS (GNU/Linux 5.15.0-25-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
346 updates can be applied immediately.
136 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.