ubuntu18.04,Linux使用远程连接工具连接失败解决

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 ```

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章