“This is the 16th day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.”
Related articles
Java with Notes: Java with Notes
1. Add user root
-
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 ubuntu@118.89193.239.
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
2. Enable SSH remote login
- 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
Copy the code
- 2. Check whether SSH is successfully installed
ps -e |grep ssh
Copy the code
- 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
Copy the code
- 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)
Copy the code
- This is because we did not enable 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
- Try connecting again:
ssh root@118.89193.239.
Copy the code
- The connection is successful:
- 5. Restart the SSH service
sudo service ssh restart
Copy the code
The road ahead is long, I see no end, I will search high and low
If you think I bloggers write well! Writing is not easy, please like, follow, comment and give encouragement to the blogger ~ Hahah