b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

ZhangZhaoxuan的博客

电脑杂谈  发布时间:2019-08-22 04:03:53  来源:网络整理

修改树莓派用户密码_树莓派 默认密码_树莓派 帐号密码

忘记树莓派密码怎么办?

原文连接:

大致过程是这样的:

1、首先将sd卡从树莓派取出,

2、在另一台电脑上,修改初始化进程为bin目录下的sh;

3、然后插入树莓派启动起来,启动后会停留在命令行,在此通过passwd加你的用户名来设定密码(即使root也可以在此修改,这里之前能否初始化过root密码不太确定)

4、树莓派关机,取出sd卡,插入另一台电脑,恢复启动文件树莓派 默认密码,修改密码过程完成

详细流程看翻译吧

翻译如下:

Step 1 – Grab The SD Card

步骤1-取出sd卡

Power down the Pi and remove the SD card. Insert it into your PC.

将树莓派关机,移除sd卡,插入到你的手机

Step 2 – Edit cmdline.txt

步骤2-编辑cmdline.txt

The boot partition should be visible and contain a file named “cmdline.txt”. Edit this file in a text editor and add the following to the end of the existing text :

启动部分是可见的,并包括一个名为“cmdline.txt”的文件。在编辑器中编辑这个文本,并将下文插入到已有文本的最后

init=/bin/sh

If the original content was :

如果原文是这样的:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

树莓派 帐号密码_树莓派 默认密码_修改树莓派用户密码

it should now look like :

那么编辑后需要是这样的:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait init=/bin/sh

Make sure it is all one line! Save the text file and eject the SD card from the PC.

确保所有内容在同一行。保存文本内容,从pi出取出sd卡

Step 3 – Reset the Password

步骤3-重设密码

Insert the card into a Pi that is connected to a monitor and keyboard. Power up the Pi. There may be a delay but you should be presented with a flashing cursor.

将sd卡插入树莓派(我们在这里需要连上显示器和鼠标)。将树莓派开机,估计在显示闪动的光标前应该等一会。

At the prompt type the following command :

在标识符后,输入下面命令:

passwd pi

You will then be prompted for a new password. Enter it carefully and press the [Return] key. It will now ask you to retype the password.

你会被提醒输入一个新的密码,请仔细键入后并敲下回车键。系统会提醒你继续确定输入密钥

The password has been changed.

这样密码就更改完成了

Now type the following commands :

现在输入下述命令去同步并执行初始化程序

sync

exec /sbin/init

The Pi will continue to boot and return you to the normal command line prompt.

树莓派 默认密码_修改树莓派用户密码_树莓派 帐号密码

树莓派会继续启动

Shutdown the Pi and power it off.

关掉树莓派并且断电

sudo halt

Step 4 – Edit cmdline.txt

第四步-编辑cmdline.txt文本

Using the PC edit the “cmdline.txt” file again and remove the “init=/bin/sh” text you added in Step 2.

用电脑继续编辑这个文本:把我们在第二步加入的最终数据删除

You can now return the SD card to your Pi, reboot and use the new password.

现在你可以插入sd卡到你的树莓派啦,再次开启就可以使用新的密码啦。

提示Authentication token manipulation error错误的理由是:

1、分区没有空间造成。

2、/etc/passwd 和/etc/shadow不同步

但是现在前面两条却行不通,通过df查看根分区还有40%剩余。

1、尝试更改密码,出现出错

Changing password for user root.

New UNIX password:

BAD PASSWORD: it is WAY too short

Retype new UNIX password:

passwd: Authentication token manipulation error

2、同步/etc/passwd 和/etc/shadow出错

树莓派 帐号密码_修改树莓派用户密码_树莓派 默认密码

#pwconv

pwconv: can’t lock passwd file

3、看权限没有异常,也没有进程锁定该文件

-rwxr–r– 1 root root 2752 Dec 31 17:29 /etc/passwd

4、cp lock文件错误,提示空间不足

cp: cannot create regular file `/etc/.pwd.lock’: No space left on device

5、上面的出错惊醒了我树莓派 默认密码,查看确实是inode满了,删除无用的文件

FilesystemInodes IUsed IFree IUse% Mounted on

/dev/sda52562240 25622400 100% /

/dev/sda15020047 50153 1% /boot

/dev/sda25130000012 51299988 1% /data/cache1

/dev/sdb151300000 7080311 44219689 14% /data/cache2

/dev/sdb2986316811 9863157 1% /data/proclog

none2159071 215906 1% /dev/shm

/dev/sda33842720 305795 3536925 8% /usr

/dev/sda73162112 7893 3154219 1% /var

6、再次更改密钥仍然错误,于是尝试设置/etc/passwd也出现出错

chmod: changing permissions of `/etc/passwd’: Operation not permitted

7、执行chattr

2095582053 ————- /etc/passwd

8、同步文件

树莓派 帐号密码_树莓派 默认密码_修改树莓派用户密码

pwconv

9、成功更改密钥

passwd

Changing password for user root.

New UNIX password:

BAD PASSWORD: it is WAY too short

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

附:pwconv

功能说明:开启用户的投影密码。

语法:pwconv

补充说明:Linux系统里的客户和群组密钥,分别保存在名称为passwd和group的文 件中,这两个文件位于/etc目录下。因平台运作所需,任何人都得以读取它们,造成安全上的弱点。投影密码将文件内的密码改存在/etc目录下的 shadow和gshadow文件内,只禁止系统管理者读取,同时把原密码置换为”x”字符,有效的加强了平台的安全性。

pwconv:开启用户的shadow口令.

一般来用pwconv来同步口令,下面来说一下,它的工作步骤:

pwconv依赖于passwd中的密钥区’x’来同步/etc/passwd与/etc/shadow这两个文件;以/etc/passwd为主来控制/etc/shadow中的各项:

A:若/etc/shadow不存在,则pwconv将用/etc/passwd来建立

B:若/etc/shadow已存在,则:

1.若条目在passwd中已存在,而不在shadow中,则在shadow中添加相关条目

2.若条目在shadow中已存在,而不在passwd中,则从shadow中删去相关条目

Linux下出现Read-only file system的缓解方法

正常运行中的网站,忽然间出现session目录不可写,连接服务器一看,任何关于写硬盘的命令都不能用,提示Read-only file system,使用一条命令就能搞定此问题:

1. mount -o remount rw /

本文地址:


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/bofangqi/article-120122-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      热点图片
      拼命载入中...