設(shè)置root用戶密碼
輸入以下命令修改root用戶密碼
sudo passwd root
輸入以下命令切換到root用戶
su root
僅允許root用戶用密碼登錄
輸入以下命令編輯ssh配置文件
vi /etc/ssh/sshd_config
新增以下配置允許root用戶登錄
PermitRootLogin yes
把PasswordAuthentication修改為yes,允許用密碼登錄
PasswordAuthentication yes
保存退出后輸入以下命令重啟SSH服務(wù)
systemctl restart sshd
僅允許root用戶用ssh key登錄
輸入以下命令編輯ssh配置文件
vi /etc/ssh/sshd_config
新增以下配置允許root用戶登錄
PermitRootLogin yes
如果之前把PasswordAuthentication修改為yes了,則重新設(shè)置為no
PasswordAuthentication no
輸入以下命令編輯授權(quán)Key
vi ~/.ssh/authorized_keys
把ssh-rsa之前的文本全部刪除,否則會報以下錯誤
Please login as the user "ubuntu" rather than the user "root".
保存退出后輸入以下命令重啟ssh服務(wù)即可
systemctl restart sshd
文章來源:http://www.zghlxwxcb.cn/news/detail-744693.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-744693.html
到了這里,關(guān)于開啟AWS的ubuntu服務(wù)器的root用戶登錄權(quán)限的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!