## **初始化 修改root 密码**
在已知原来的密码的情况下,
打开终端输入:sudo passwd
Password: <— 输入你当前用户的密码
Enter new UNIX password: <— 新的Root用户密码
Retype new UNIX password: <— 重复新的Root用户密码
passwd:password updated successfully
成功之后 su - root
*****
## **ubuntu 百度 ping不通的原因**
![](https://img.kancloud.cn/6a/f5/6af5e43435d72340e6c3bfb4051bc91e_673x471.png)
*****
## **xshell连不上虚拟机的原因 ______openssh-server没有安装 **
![](https://img.kancloud.cn/68/15/68152d3d1e2da0529391e8a1b742cd11_861x426.png)
直接安装报错
**解决办法:**
1、关闭防火墙
sudo ufw disable
2、开发22端口
sudo ufw allow 22
3、最后安装ssh
sudo apt-get install openssh-server
https://blog.csdn.net/weixin_44648313/article/details/109077765
#### **如果不成功则看下面**
(1)备份/etc/apt/sources.list
~~~javascript
sudo cp -i /etc/apt/sources.list /etc/apt/sources.list.backup
~~~
(2)更新repos (我未做)
将以下的内容添加到/etc/apt/sources.list(或者将原来的内容清空再添加下面的源)
~~~javascript
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
~~~
(3)更新:
~~~javascript
sudo apt-get update
~~~
(4)安装
~~~javascript
sudo apt-get install openssh-server
~~~
然后就能安装成功了,如果遇到版本依赖的冲突,先按照提示安装对应的依赖版本:如
~~~javascript
apt install openssh-client=1:6.6p1-2ubuntu2.10
~~~
再正常安装对应的软件包就可以了
##**如果是这个错误**
![](https://img.kancloud.cn/27/8f/278f38a25e6263eb729dcfecadd83df0_743x154.png)
解决方法:
删掉之前遗留下来的进程
sudo rm /var/cache/apt/archives/lock-frontend
sudo rm /var/lib/dpkg/lock-frontend
1
2
扩展:
要根据问题提示来具体解决,有可能问题提示如下:
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavialable)
这里的lock 跟上面的 lock-frontend 实际上没多大区别,改一下删除的对象即可
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock
转载于:https://www.cnblogs.com/zlfProgrammer/p/10142875.html
### **xshell密码拒绝的问题**
找到这个
![](https://img.kancloud.cn/39/f9/39f99a73856c72699fa07a908254a8c6_691x223.png)
配置如下
![](https://img.kancloud.cn/56/65/56652ff1cffeda73e00556dad33f6bdb_792x352.png)
# 最后再reboot