root
accountssh-keygen -p -f path_to_private_key
Some server providers disable the root user by default, instead have 1 user account, for example ubuntu
, and this user can be sudo
To allow root login you do the following
ubuntu
if [ "$EUID" -ne 0 ]; then
sudo su
fi
# Find the line in the file that contains "PermitRootLogin"
line1=$(grep -n -m 1 "^#*\s*PermitRootLogin" /etc/ssh/sshd_config | cut -d: -f1)
# Replace the line with "PermitRootLogin yes"
sed -i "${line1}s/.*/PermitRootLogin yes/" /etc/ssh/sshd_config
# Find the line in the file that contains "PasswordAuthentication"
line2=$(grep -n -m 1 "^#*\s*PasswordAuthentication" /etc/ssh/sshd_config | cut -d: -f1)
# Replace the line with "PasswordAuthentication yes"
sed -i "${line2}s/.*/PasswordAuthentication yes/" /etc/ssh/sshd_config
# Restart the ssh service to apply the changes
systemctl restart ssh
# Change the root password
sudo passwd root
Go back to FlashVPS Panel and connect as instructed above.
For AWS servers, when you log in with the root account, there will be a message like this and the connection will be lost. Please log in to your ubuntu account and execute the following command.
sudo su
sed -i -e 's/.*exit 142" \(.*$\)/\1/' /root/.ssh/authorized_keys