Ubuntu 19.10 enables ssh service (detailed process)

Ubuntu 19.10 enables ssh service (detailed process)

It took me more than an hour to open ssh in Ubuntu. The main reason was that the tutorial steps I read at the beginning were not detailed. Then I turned on a host worth more than 10,000 yuan, and the startup and shutdown were quite slow. I recorded the detailed steps here for your convenience in future reference.

The first step is to check whether ssh is enabled.

sudo ps -e | grep ssh

If the final return is sshd, it proves that ssh has been enabled and jump to step 4


Step 2, if there is no display, try to enable the ssh service

sudo /etc/init.d/ssh start

If the command is not found, it means that the ssh service is not installed.

The third step is to install the openssh service and check whether the service is enabled.

sudo apt-get install openssh-server
sudo ps -e | grep ssh

If not, run the enable command

sudo /etc/init.d/ssh start

Step 4: Check if the firewall has port 20 open (SSH opens port 22 by default, if you need to modify it, see step 5)

netstat -an | grep 22
# or ufw status

If not, open port 22

ufw allow 22

Step 5: Change the ssh port (optional)

sudo vi /etc/ssh/sshd_config

ssh restart

service sshd restart

Step 6: Firewall takes effect and starts up

ufw enable

Step 7: Check the IP address, remember the IP address, and set a static IP

ifconfig 


Set static ip:
Open vim /etc/netplan/ and check. I have seen other people's articles use vim /etc/netplan/01-netcfg.yaml, but I use 50-cloud-init.yaml, so they may not be the same.

cd /etc/netplan/
ls
vim 50-cloud-init.yaml

Set to

network:
  ethernets:
    enp3s0:
      dhcp4: false
      addresses: [192.168.101.135/24]
      gateway4: 192.168.101.1
      nameservers:
          addresses: [192.168.101.1, 8.8.8.8]
    enp4s0:
      dhcp4: true
  version: 2

Next, ping the computer to see if it works. If not, check whether it is in the same subnet and gateway. Then download xshell or putty. Remember to enter the port correctly.

Optional: Set up root login to ssh

sudo vim /etc/ssh/sshd_config

Change PermitRootLogin prohibit-password to PermitRootLogin yes
Remember to restart ssh

sudo systemctl restart sshd

Then the next step is to connect to the computer using xshell or putty, remember to select port 22, if you have not changed it

This is the end of this article about how to enable ssh service in Ubuntu 19.10 (detailed process). For more information about how to enable ssh in Ubuntu 19.10, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed installation and use of SSH in Ubuntu environment
  • Detailed installation and configuration of SSH for remote login to Ubuntu server
  • How to configure SSH passwordless authentication in Ubuntu
  • How to check whether the ssh service is installed or started in Ubuntu
  • Detailed explanation of Ubuntu 14.04 bridge network settings and SSH login
  • Detailed explanation of the installation and login of ssh service under Ubuntu (ssh remote login)
  • Ubuntu 16.04 server configuration ssh password-free login
  • Detailed tutorial on installing openssh server on ubuntu

<<:  JavaScript setTimeout and setTimeinterval use cases explained

>>:  mysql root user cannot be authorized and solve the problem of navicat remote authorization prompt 1044

Recommend

Detailed explanation of Apache SkyWalking alarm configuration guide

Apache SkyWalking Apache SkyWalking is an applica...

Detailed explanation of the use of base tag in HTML

In requireJS, there is a property called baseURL....

Implementation of Nginx Intranet Standalone Reverse Proxy

Table of contents 1 Nginx Installation 2 Configur...

Details of 7 kinds of component communication in Vue3

Table of contents 1. Vue3 component communication...

Basic usage of UNION and UNION ALL in MySQL

In the database, both UNION and UNION ALL keyword...

Detailed explanation of how to use the canvas operation plugin fabric.js

Fabric.js is a very useful canvas operation plug-...

Whitespace processing in HTML/CSS and how to preserve whitespace in the page

Whitespace rules in HTML In HTML, multiple spaces...

Encoding problems and solutions when mysql associates two tables

When Mysql associates two tables, an error messag...

Detailed installation and use of RocketMQ in Docker

To search for RocketMQ images, you can search on ...

Vue-CLI3.x automatically deploys projects to the server

Table of contents Preface 1. Install scp2 2. Conf...

Detailed explanation of props and context parameters of SetUp function in Vue3

1. The first parameter props of the setUp functio...

Teach you how to build a react+antd project from scratch

The previous articles were all my own learning lo...

Each time Docker starts a container, the IP and hosts specified operations

Preface Every time you use Docker to start a Hado...