前言
之前擼了Google雲之後,因爲不能root登錄的原因,困擾了一段時間。雖然google默認禁用root賬戶登錄是爲了安全着想,不過對於搭建$$R或者建立小博客的我們來說,顯然是開啓root登錄更爲方便。正好今天想起來了,就發出來吧。
第一步
以普通用戶登入後,切換到root賬戶
sudo -i
第二步
修改root密碼
passwd root
第三步
修改SSH配置文件
vi /etc/ssh/sshd_config
按i
進入編輯
找到PermitRootLogin和PasswordAuthentication
# Authentication:
#LoginGraceTime 2m
PermitRootLogin no //默認爲no,需要修改爲yes
#StrictModes yes
#MaxAuthTries 6
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication no //默認爲no,需要修改爲yes
#PermitEmptyPasswords no
ESC
結束編輯,:wq
保存修改並退出
第四步
重啓SSH服務使修改生效
/etc/init.d/ssh restart
好了,到了這一步之後我們的VPS就可以使用root登錄了。
如果還是不行,可以試試Winscp普通用戶sftp登錄獲取root權限。