This is the second day of my participation in Gwen Challenge


Ubuntu16.04 installing SSH and enabling remote services (server use)

  • Just bought a Tencent cloud server, from today officially a server belonging to my own. The Settings are Ubuntu16.04.

  • All the following operations are performed by the root user: If you are not in the root user login state, add sudo before all commands

    • 1. Install the SSH

    apt-get install openssh-server

    • 2. Check whether SSH is successfully installed

    ps -e |grep ssh

    • If the following information is displayed: If SSHD exists, the SSH service is started

  • 3. If the SSH service is not enabled, run the following command: The SSH service is enabled

    service ssh start

  • 4. At this time, all our services have been started, but the remote connection may report the following error:

Permission denied, please try again(publickey,password)

This is because we have not enabled the remote connection service: first open the /etc/ssh/sshd_config file

vim /etc/ssh/sshd_config
Copy the code
  • The following information is displayed:

Find the PermitRootLogin Prohibit-Password location, comment it out, and add the following to the original location:

PermitRootLogin yes
Copy the code

5. Restart the SSH service

sudo service ssh restart
Copy the code

OK, problem solved, you can successfully connect to the remote server!

Add user root to Ubuntu and allow user root to log in

Because the default user of Tencent cloud service is Ubuntu user every time I log in, but I need to use SCP command to upload some files to the server, many operations do not have permissions, it is very troublesome, so I change it to allow root user to log in.

1. Log in to Ubuntu using the following command:

SSH [email protected]Copy the code

The following information is displayed:2. Run the following command to change the root password:

sudo passwd root
Copy the code

Password input is not visible and needs to be entered again!

The following information is displayed:3. Run the following command to modify the SSH configuration:

sudo vi /etc/ssh/sshd_config
Copy the code

4. Restart the SSH service

sudo service ssh restart
Copy the code

Done! This allows you to log in remotely as user root.


Don’t get lost oh ~