root
accountssh-keygen -p -f path_to_private_key
Một số nhà cung cấp máy chủ mặc định vô hiệu hóa người dùng root, thay vào đó có 1 tài khoản người dùng chẳng hạn ubuntu
và người dùng này có thể lên sudo
Để cho phép root login bạn làm như sau
ubuntu
# Check if the user is root
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
sudo su
fi
# Change the root password
echo "Please enter a new password for the root user"
sudo passwd root
# 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
echo "Done! You can now connect to FlashVPS.dev with the root user and the new password"
Quay lại FlashVPS Panel và tiến hành kết nối như hướng dẫn ở trên.