重置树莓派的密码
2016-03-06 11:58
656 查看
How To Reset A Forgotten Raspberry Pi Password
I’ve got a Raspberry Pi running in my garage as part of a security system. It’s been running for so many months that I forgot the password so I was unable to access it via SSH.Luckily there is was a technique that I could use to reset the password and get it back up and running. You need physical access to the SD card, a separate PC and the ability to connect your Pi to a monitor and keyboard. I used a Windows PC but this should work fine on a Mac or Linux machine.
Step 1 – Grab The SD Card
Power down the Pi and remove the SD card. Insert it into your PC.Step 2 – Edit 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 :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.
Step 3 – Reset the Password
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.At the prompt type the following command :
mount -rw -o remount /
then
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.
Reset Lost 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
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.
Article from http://www.raspberrypi-spy.co.uk/2014/08/how-to-reset-a-forgotten-raspberry-pi-password/
相关文章推荐
- Patrol 7 架构下?的处理方法
- 清除IE分级审查密码
- 华为路由器密码恢复
- 注册表导出管理员密码文件
- 路由器版本与密码恢复
- 密码知识教程一
- 密码破解全教程
- 通过批处理修改FTP账号和密码
- redis中修改配置文件中的端口号 密码方法
- C#判断密码强度的方法
- C#使用伪随机数实现加密用户密码的方法
- Mysql5.6 忘记root密码的解决办法
- C#修改及重置电脑密码DirectoryEntry实现方法
- MySql5.5忘记root密码怎么办
- Mysql忘记root密码怎么办
- 深入密码加salt原理的分析
- C#动态创建Access数据库及密码的方法
- js检测用户输入密码强度
- JQuery记住用户名密码实现下次自动登录功能
- jquery判断输入密码两次是否相等