赞
踩
Ubuntu 系统信息:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
在 Ubuntu 操作系统中,使用 sudo apt-get install openssh-server
安装 OpenSSH 服务端:
$ sudo apt-get install openssh-server
安装完成,使用 sudo systemctl status sshd
命令查看 OpenSSH 服务端的状态(第 1 行),可知 OpenSSH 服务端已经在运行(第 4 行):
$ sudo systemctl status sshd ● ssh.service - OpenBSD Secure Shell server Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2022-02-21 09:09:50 CST; 50s ago Docs: man:sshd(8) man:sshd_config(5) Main PID: 4051 (sshd) Tasks: 1 (limit: 4588) Memory: 1.0M CGroup: /system.slice/ssh.service └─4051 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups 2月 21 09:09:50 mk-virtual-machine systemd[1]: Starting OpenBSD Secure Shell server... 2月 21 09:09:50 mk-virtual-machine sshd[4051]: Server listening on 0.0.0.0 port 22. 2月 21 09:09:50 mk-virtual-machine sshd[4051]: Server listening on :: port 22. 2月 21 09:09:50 mk-virtual-machine systemd[1]: Started OpenBSD Secure Shell server.
在 Windows 10 操作系统中,打开 PowerShell,使用 ssh -l login_name destination
命令格式连接目标主机:
PS C:\Users\Admin> ssh -l mk 192.168.132.134 The authenticity of host '192.168.132.134 (192.168.132.134)' can't be established. ECDSA key fingerprint is SHA256:U3XR4lbb5hhSp4fCycZwN/gO5thnzQ7K9EqcQ1HU5zM. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.132.134' (ECDSA) to the list of known hosts. mk@192.168.132.134's password: Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.13.0-30-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 89 updates can be applied immediately. 1 of these updates is a standard security update. To see these additional updates run: apt list --upgradable Your Hardware Enablement Stack (HWE) is supported until April 2025. 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.
登录成功,查看谁正在登录:
mk@mk-virtual-machine:~$ w
11:28:20 up 2:32, 2 users, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
mk :0 :0 08:56 ?xdm? 44.74s 0.01s /usr/lib/gdm3/gdm-x-session --run-script env GNOME_SHEL
mk pts/1 192.168.132.1 10:51 0.00s 0.03s 0.01s w
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。