SSH 安装和查看
阅读时间: 2 min
安装 SSH(Secure Shell)服务是在 Linux 系统中进行远程管理和安全登录的常见做法。
以下是在常见的 Linux 发行版中安装 SSH 服务的步骤:
-
打开终端,并以管理员权限(sudo)登录。
-
输入适用于你的 Linux 发行版的安装命令:
-
Ubuntu/Debian:
sudo apt-get install openssh-server -
CentOS/Fedora:
sudo dnf install openssh-server -
Arch Linux/Manjaro:
sudo pacman -S openssh
-
-
输入管理员密码以确认安装。输入密码后,按下回车键继续。
-
安装完成后,SSH 服务将自动启动。使用以下命令检查 SSH 服务的状态:
-
Ubuntu/Debian:
systemctl status ssh -
CentOS/Fedora:
systemctl status sshd -
Arch Linux/Manjaro:
systemctl status sshd
如果服务正在运行,你将看到类似于”active (running)“的状态信息。
Terminal window ● ssh.service - OpenBSD Secure Shell serverLoaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)Active: active (running) since Fri 2023-11-10 10:49:09 CST; 32min agoDocs: man:sshd(8)man:sshd_config(5)Main PID: 17171 (sshd)Tasks: 1 (limit: 4165)Memory: 1.4MCPU: 138msCGroup: /system.slice/ssh.service└─17171 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"11 月 10 10:49:09 E systemd[1]: Starting OpenBSD Secure Shell server...11 月 10 10:49:09 E sshd[17171]: Server listening on 0.0.0.0 port 22.11 月 10 10:49:09 E sshd[17171]: Server listening on :: port 22.3 collapsed lines11 月 10 10:49:09 E systemd[1]: Started OpenBSD Secure Shell server.11 月 10 10:52:57 E sshd[18783]: Accepted password for youyu from 192.168.10.164 port 64557 ssh211 月 10 10:52:57 E sshd[18783]: pam_unix(sshd:session): session opened for user youyu(uid=1000) by (uid=0) -