VPS啓用root密碼登錄(Enable ssh login as root with password)

Linux·小知識 · 03-24 · 90 人浏览
VPS啓用root密碼登錄(Enable ssh login  as root with password)

有些VPS商家不會提供默認root賬戶和密碼,有些命令只能通過 sudo su 來提權,可通過以下方法設置root賬戶登錄。 (Some VPS providers do not provide a default root account and password. Some commands can only be executed with elevated privileges using sudo su. You can set up a root account login using the following method:)

sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config
sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config

然後重置密碼(Then set our password for root)

passwd root

重啓ssh服務(Restart sshd service)

sudo service sshd restart
Linux
本站立足于美利堅合衆國,請讀者自覺遵守當地法律!如有違規,本站不承擔任何法律責任! This site is based in the United States of America, readers are requested to abide by local laws! If there are any violations, this site does not bear any legal responsibility! Theme Jasmine by Kent Liao