From 1a6b136bc59118ee43644b209e6d3eb7d9e5460c Mon Sep 17 00:00:00 2001 From: "lion.chan" Date: Mon, 28 Jun 2021 20:20:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20Raspberry=20Pi=204B=20Ubun?= =?UTF-8?q?tu=20=E5=BC=80=E5=90=AF=20SSH.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lion.chan --- .../Raspberry_Pi_4B_Ubuntu_开启_SSH.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Software/System/RaspberryPi/Raspberry_Pi_4B_Ubuntu_开启_SSH.md diff --git a/Software/System/RaspberryPi/Raspberry_Pi_4B_Ubuntu_开启_SSH.md b/Software/System/RaspberryPi/Raspberry_Pi_4B_Ubuntu_开启_SSH.md new file mode 100644 index 0000000..6431856 --- /dev/null +++ b/Software/System/RaspberryPi/Raspberry_Pi_4B_Ubuntu_开启_SSH.md @@ -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 +```