ubuntu18.04使用遠程連接工具連接失敗解決
一.首先查詢服務器ip
- ifconfig 無法使用
安裝net-tools 工具
sudo apt install net-tools
- 出現could not get lock /var/lib/dpkg/lock-frontend 問題
```bash 原因: 當前或者後臺正在運行軟件更新程序或者apt命令 | 進程處於運行狀態
解決: # 幹掉所有的apt sudo killall apt apt-get
# 如果還不行,執行下面的刪除命令
sudo rm /var/lib/apt/lists/lock /var/cache/apt/archives/lock /var/lib/dpkg/lock*
```
- ssh 無法連上
```bash
檢查ssh是否有在運行 , 如果沒有打印sshd 則表明有可能沒有。
sudo ps -e |grep ssh
安裝ssh服務
sudo apt-get install openssh-server
安裝完畢後shh服務會自動啓動,可以在使用 第一行的ps查找命令,看看是否有sshd 運行
如果還沒有,可以手動啓動
sudo service ssh start
```
- 無法使用使用root用戶登錄
```bash
1. 修改root用戶的密碼 回車後會要求輸入root用戶的密碼。
sudo passwd root
2. 修改sshd_config
vi /etc/ssh/sshd_config
修改前
# Authentication:
#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
修改後
# Authentication:
LoginGraceTime 2m
#PermitRootLogin prohibit-password
PermitRootLogin yes
StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
3. 重啓ssh , 然後再連接即可
/etc/inid.d/ssh restart ```