Last active
November 7, 2019 12:34
-
-
Save mhrubel/43825450cba521ede15d7b73cf865472 to your computer and use it in GitHub Desktop.
SSH on various Linux based VPS or Dedicated server comes configured in a way that disables the root users log in. As a security precaution, it's enabled, which means that you cannot directly log in as the root user over SSH. However, In some cases, though it is just more convenient to get directly logged in as root.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Login to your server | |
### Create a root user password | |
sudo passwd root | |
### Choose a strong password!**** | |
### Lets Edit SSHD Config file | |
sudo nano /etc/ssh/sshd_config | |
### Remove the Comment (#) sign from Port and Enable the port | |
Port 22 | |
### Add below text inside the file (sshd_config) under "Authentication" block | |
PermitRootLogin yes | |
### Search for "PasswordAuthentication" (CTRL and w at the same time using keyboard). And change it to YES alike below text. | |
PasswordAuthentication yes | |
### Save the file (CTRL and x at the same time using keyboard and the press yes and then press Enter on the keyboard to exit the file) | |
### Lets Restart the SSHD service | |
sudo systemctl restart sshd | |
# OR | |
sudo service sshd restart | |
NOTE: This guide should work with almost all Ubuntu and Debian based OS versions... | |
But, most probably it will work with the recent versions of all Linux OS... | |
This should works with all kind of VPS or Dedicated servers provider worlwide... | |
EX: Amazon Ec2, Amazon Lightsail, DigitalOcean, Vultr, Alibaba Cloud, Google Cloud etc... | |
DISCLAIMER: I'm not responsible if you brake anything from the server using this guide! Use this guide at YOUR OWN RISK... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should also work with CentOS! Test it and comment here! But, do it at your own risk.... Thanks...