当前位置:网站首页>What if once again forgets the login password of raspberry pie? And you don't have a monitor yet! Today, I would like to introduce a method

What if once again forgets the login password of raspberry pie? And you don't have a monitor yet! Today, I would like to introduce a method

2022-07-07 23:32:00 Little river god is tangled

Preface

        I believe you won't go to your raspberry pie for a long time , Will forget the password , But I don't have a monitor , There is no way to use modification cmdline.txt To retrieve the password . Today, I will introduce a modification pi To change the login password of raspberry pie .

One 、 Preparation before modification

       1. A card reader ;
       2. It can be used Linux System , such as ubuntu virtual machine .

Two 、 Modification steps

1. Mount the memory card of raspberry pie to the virtual machine

        Remove the memory card of raspberry pie , Install it in the card reader and insert it into the computer ; And connect to the virtual machine ,
 Insert picture description here
And then open the terminal , Check whether the memory card exists :

dmesg

 Insert picture description here
Create an empty folder in the current path , And put the memory card sdg2( The first mount is usually sdb2) Mount to this file :

mkdir ext4
sudo mount /dev/sdg2 ext4	
cd ext4/

2. Change Password

        The passwords for raspberry pie are all in /etc/shadow Under the folder , But the password inside is encrypted , We have no idea what that means :
 Insert picture description here
But what we can only know is ,pi The back two The colon It must be a password . Then we can change the password as long as we modify these contents .
        We can start at Ubuntu Create a temporary user in , And the user sets the password , In this way, we can replace the password of this user pi I've got my password .
        stay Ubuntu Terminal creation user :

sudo useradd test
sudo passwd test
// Enter your own password 

Once created , open Ubuntu Of shadow:

sudo vi /etc/shadow

 Insert picture description here
Now , Just put test The password part of is overwritten pi The same part of , You can successfully change the password of raspberry pie .

原网站

版权声明
本文为[Little river god is tangled]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130559025504.html