重置树莓派的密码
来源:互联网 发布:统计表制作软件 编辑:程序博客网 时间:2024/05/16 06:57
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/
- 重置树莓派的密码
- 重置weblogic的密码
- 重置MySQL的密码
- 常用的“密码重置”代码
- 重置opensolaris的root密码
- oracle的sys密码重置。
- 重置rhel的root密码
- VSS的admin密码重置
- 重置Mysql的root密码
- 如何重置mysql的密码
- 重置mysql的root密码
- ubuntu的recovery重置密码
- Oracle重置过期的密码
- 重置mysql的root密码
- CentOS7的Root密码重置
- CentOS7的Root密码重置
- CentOS7的Root密码重置
- 重置遗忘的mysql密码
- POJ 1679 The Unique MST 次小生成树
- 【历届试题】矩阵翻硬币
- 在嵌入式设备上设定ftp服务器的家目录
- android CoordinatorLayout使用
- 20160303线性模型.md
- 重置树莓派的密码
- POJ 2010 Moo University - Financial Aid (优先队列/二分答案)
- jQuery总结
- 简化脚本
- Linux系统运维/正则表示法/6-1
- 项目2:就拿胖子说事---(1)计算并输出标准体重
- LeetCode : 3Sum [java]
- Java 抽象类与接口区别
- fzu2092收集水晶 记忆化搜索