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

Implementation of CSS3 button border animation

First look at the effect: html <a href="#...

Nexus uses nginx proxy to support HTTPS protocol

background All company websites need to support t...

Explanation of building graph database neo4j in Linux environment

Neo4j (one of the Nosql) is a high-performance gr...

Reasons and solutions for not being able to detect array changes in Vue2

Table of contents Workaround Why can't I moni...

Specific use of MySQL operators (and, or, in, not)

Table of contents 1. Introduction 2. Main text 2....

Database SQL statement optimization

Why optimize: With the launch of the actual proje...

How to add abort function to promise in JS

Table of contents Overview Promise Race Method Re...

How to implement remote automatic backup of MongoDB in Linux

Preface After reading the previous article about ...

Detailed analysis of the chmod command to modify file permissions under Linux

Use the Linux chmod command to control who can ac...

Examples of correct use of maps in WeChat mini programs

Table of contents Preface 1. Preparation 2. Actua...

How to modify the root password of mysql under Linux

Preface The service has been deployed on MySQL fo...

Steps to set up Windows Server 2016 AD server (picture and text)

Introduction: AD is the abbreviation of Active Di...

SQL injection vulnerability process example and solution

Code example: public class JDBCDemo3 { public sta...

Docker implements cross-host container communication based on macvlan

Find two test machines: [root@docker1 centos_zabb...