The target

SSH access to Ubuntu from another computer

Hardware and software versions

Computer accessed Computer: Lenovo Notebook G470 System: Ubuntu 16.04

Client COMPUTER computer: MBP system: 10.15.2

To prepare

SSH

SSH is short for Secure Shell. It is formulated by the Network Working Group of the Internet Tf. SSH is a security protocol based on the application layer. SSH is a reliable protocol that provides security for remote login sessions and other network services. The SSH protocol can effectively prevent information leakage during remote management. SSH began as a program on UNIX systems and quickly expanded to other operating platforms. SSH, when used correctly, makes up for network vulnerabilities. SSH clients are applicable to multiple platforms. Almost all UNIX platforms — including HP-UX, Linux, AIX, Solaris, DigitalUNIX, Irix, and others — can run SSH. SSH — SSH

Target analysis

We now know that SSH was originally a security protocol designed for remote login sessions. Because of this protocol, the derived SSH program is the software we will install. To connect two machines using SSH, you can imagine that one will be accessed as a client and the other as a server providing the services being accessed. We also know that many Unix-like systems such as Linux and OSX already have SSH clients, and Windows also has many excellent programs such as PuTTY. So, what we are going to do is actually how to install and start SSH Server.

steps

① Check whether the SSH service is installed on Ubuntu

systemctl status ssh
Copy the code

For example, the machine execution result of this new system is as follows:

We notice two things, the first line load result is not found, because there is no file or directory, the second line service status is inactive, dead. From these words we can guess that the service is not installed at all. In the same way, if you see the stopped state in red, you can run the sudo systemctl start SSH command to try to start the SSH. You can also see step 3.

② Install the SSH Server

sudo apt install openssh-server
Copy the code

The execution process is as follows

3 Check the status of the Ubuntu SSH service

systemctl status ssh
Copy the code

The result is as follows

The ssh.service file is loaded on the first line. The second row is active and running; And noticed a daemon called SSHD; And then you see that the port that you’re listening for is 22.

At this point, our SSH server is installed and started OK.

4 determine the IP address of the Ubuntu machine

We tested it on a LAN, which is to check the current LAN IP, by clicking on network Settings, or ifcofnig as a reference in the image below, to find your active network card. For example, this machine has 192.168.0.145.

⑤ Check whether Ubuntu is accessible

Ping 192.168.0.145Copy the code







SSH: connect to host 192.168.0.145 Port 22: Connection refused

⑥ If you cannot access it, check the Ubuntu firewall

# check firewall
sudo ufw status verbose

# enable firewall
sudo ufw enable

# open port
sudo ufw allow 22
Copy the code

To enable the access permission of a port from an IP address, run the following command

sudo ufw allow from your_ip to any port 22
Copy the code

⑦ Use your account password to log in to Ubuntu

Now, use a different computer to try to log in to Ubuntu

SSH [email protected] - p. 22Copy the code

For the first login will prompt the host is not recognized, encryption signature refers to

Enter yes to confirm the login password of the current Ubuntu user Baiyutang.

extension

  • What is Openssh-server?

Ubuntu Wiki OpenSSH Server About OpenSSH

  • Can THE port opened by the SSH server be changed?

Yes, you can configure the SSH Server port in the /etc/ssh/sshd_config file. After the modification, make sure that sudo systemctl restart SSHD takes effect after the SSHD restart. The modification position is shown in line 5 of the figure below:

  • Ufw and basic management operations

Ubuntu firewall Settings can be covered separately, or you can see Resources # 4 first.

  • How do I Use a Public Key to Log in confidentially?
  • How does SSH encrypted transmission work?
  • What is an encrypted signature fingerprint?

This will be recorded in the next chapter. The three questions can be put together.

  • How do I configure a jumper?

And we’ll do that separately.

  • Security issues and man-in-the-middle attacks

This is covered in the first reference.

  • What is Intranet penetration?

For follow-up understanding and research, I have been looking for software related to remote control for some time, which can be used as a research topic.

reference

  1. SSH basic principles and Password-free login
  2. Five suggestions for strengthening SSH security
  3. Keep the 25 best SSH commands in mind
  4. Configure a firewall with the UFW in Ubuntu
  5. Use a firewall on a Mac to prevent illegal connections