一般正常情況是可以直接使用非root用戶登錄,但是由于權限問題,所以部分內容需要遠程ROOT用戶登錄,具體如下:
1??配置root用戶密碼
一般情況下系統中root不能直接登錄,所以也沒有保存root密碼,現在需要登錄(遠程登錄),則需要進行設置密碼,命令如下:
sudo passwd root
然后回車??輸入密碼【注意👀】輸入密碼的時候是不顯示密碼的;
2??修改ssh 配置
先查看原始配置,然后再進行修改配置
cat /etc/ssh/sshd_config
修改配置
vi /etc/ssh/sshd_config
找到如下位置的:#PermitRootLogin prohibit-password
# Authentication:#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
把#PermitRootLogin prohibit-password 變成?PermitRootLogin yes
# Authentication:#LoginGraceTime 2m
#PermitRootLogin prohibit-password
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
3??刷新配置
sudo systemctl restart sshd
或者是
sudo service ssh restart
4??使用root登錄
sudo su
輸入密碼進行登錄登錄,然后操作內容就是使用root進行相關操作。