增加 Raspberry Pi 4B Ubuntu 开启 SSH.

Signed-off-by: lion.chan <cy187lion@sina.com>
This commit is contained in:
lion.chan 2021-06-28 20:20:50 +08:00
parent e62c5824b5
commit 1a6b136bc5
1 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
# Raspberry Pi 4B Ubuntu 开启 SSH
在 Ubuntu 系统下SSH 服务由 openssh-server 包提供,可使用 APT 命令安装。
```bash
sudo apt install openssh-server
```
安装成功后,编辑 /etc/ssh/sshd_config 文件,开启如下选项,其他保持默认:
```bash
Port 22
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
PermitEmptyPasswords no
UsePAM yes
TCPKeepAlive yes
Subsystem sftp internal-sftp
```
配置完毕,可使用如下命令开启/停止 SSH 服务:
```bash
# 启动 SSH 服务
sudo systemctl start sshd.service
# 使能 SSH 服务(每次开机后自动启动服务)
sudo systemctl enable sshd.service
# 停止 SSH 服务
sudo systemctl stop sshd.service
# 禁能 SSH 服务
sudo systemctl disable sshd.service
```