1. pre-installation:
alt+Ctrl+T to open terminal of ubuntu,typed in command: sudo apt-get install -y openssh-server
If error pops up like(Ubuntu):Unable to locate package**
Reason analysis: Due to a problem with the software source, the software could not be found or downloaded. The reason may be that the software source was not updated after the Ubantu was installed or updated, but there is no sudo apt-get update, resulting in the software not being found.
Solution: In the software center, update the software source; or check if the installation package exists.
In the software center, update the software source:
Step 1: sudo apt-get update
(Update the software source) to perform the installation operation. If it is not successful, go to step 2.
Step 2: sudo apt-get upgrade
(continue to update the software source) to perform the installation operation
Check if the installation package exists:
Step 1: Open website http://packages.ubuntu.com/
Step 2: GET TO Search the contents of packages, enter the library name, select exact matches, and select the system version.
System version information query method:
richie@richie-VirtualBox:~$ sudo lsb_release -a
[sudo] password for richie:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic
Step 3: Search library:
Step 4: use the package name you found on the website, it will be installed using the command: sudo apt-get install XXX
2. Install OpenSSH:
INSTALL CLIENT
sudo apt-get install openssh-client
INSTALL SERVER
sudo apt-get install openssh-server
(If the execution is not successful, use the command: sudo apt install -y openssh-server)
3. OpenSSH Commands:
service sshd status
service sshd start
service sshd stop
ps -a|grep sshd(check the process)
4. Check OpenSSH-Server status:
richie@richie-VirtualBox:~$ service sshd status
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
Active: active (running) since Fri 2019-08-23 17:02:06 CST; 7h left
Process: 1910 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCES
Process: 1906 ExecReload=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Process: 948 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 978 (sshd)
Tasks: 1 (limit: 2320)
CGroup: /system.slice/ssh.service
└─978 /usr/sbin/sshd -D
8月 23 09:02:54 richie-VirtualBox systemd[1]: Reloading OpenBSD Secure Shell ser
8月 23 09:02:54 richie-VirtualBox sshd[978]: Received SIGHUP; restarting.
8月 23 09:02:54 richie-VirtualBox systemd[1]: Reloaded OpenBSD Secure Shell serv
8月 23 09:02:54 richie-VirtualBox sshd[978]: Server listening on 0.0.0.0 port 22
8月 23 09:02:54 richie-VirtualBox sshd[978]: Server listening on :: port 22.
8月 23 09:02:54 richie-VirtualBox systemd[1]: Reloading OpenBSD Secure Shell ser
8月 23 09:02:54 richie-VirtualBox sshd[978]: Received SIGHUP; restarting.
8月 23 09:02:54 richie-VirtualBox systemd[1]: Reloaded OpenBSD Secure Shell serv
8月 23 09:02:54 richie-VirtualBox sshd[978]: Server listening on 0.0.0.0 port 22
8月 23 09:02:54 richie-VirtualBox sshd[978]: Server listening on :: port 22.
lines 1-21/21 (END)
5. Start up OpenSSH-Server:
richie@richie-VirtualBox:~$ service sshd start
6. Stop OpenSSH-Server:
richie@richie-VirtualBox:~$ service sshd stop
7. Set the network card connection method (so that the client can connect to the server):
(If you are running Linux with a virtual machine, you also need to temporarily set the system firewall off)
8. Client PuTTY login the Server:
Check server’s IP address.
richie@richie-VirtualBox:~$ ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.xx.xxx.xxx netmask 255.255.252.0 broadcast 172.xx.xxx.xxx
inet6 fe80::70f8:a129:df31:f0fc prefixlen 64 scopeid 0x20<link>
ether 08:00:27:d8:64:15 txqueuelen 1000 (Ethernet)
RX packets 26683 bytes 24776922 (24.7 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8055 bytes 672536 (672.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 669 bytes 57595 (57.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 669 bytes 57595 (57.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Using PuTTY login the server(the original port of OpenSSH is 22).
Input the PW of Server, then you are logined the Server, is able to oprate the document or something else you want.