TransWikia.com

How to unlock password for Pi account

Raspberry Pi Asked on October 5, 2021

I wanted to control my Pi with my PC via ssh. In the tutorial they recommended making a new account and locking the Pi account(for security purposes). I followed these instructions:
1.)Make New Super User/Password

sudo /usr/sbin/useradd --groups sudo -m rob

2.) Assign Password to new Super User

sudo passwd rob

3.) Uncheck the "auto login as Pi User" box in Menu->Preferences->Raspberry Pi Configuration

4.) Reboot the system

sudo reboot

5.)Ensure new user is indeed super user

sudo groups

6.) Disable the default Raspberry Pi user. Note: The reason given to do this is quote "At the time of writing the guide, the "pi" user is still needed for certain system functions. So insteed of removing it (which may cause further problems down the line), you’ll simply lock it by forcing the password to expire.)"

See code for command line entered to lock the pi account.

sudo passwd -l pi

The tutorial then informs me to update my system every now and then, which will take care of any system vulnerabilities.
They recommend entering this line into the terminal.

sudo apt-get update && sudo apt-get dist-upgrade

I got my Pi a couple of weeks ago so I’ve haven’t updated it since setup. I haven’t followed this final instruction yet.

I have two questions:

a) how do I undo this command and allow myself to log into pi@raspberry?

b) how do I easily transfer the file from one user to the other?

Edit: The file I am referring to is some python code(.py file).

Thanks

2 Answers

The first thing to do is ignore the tutorial. You do not need to create a new user, but you definitely do need to change the default password.

As far as "undoing" the command, you need to login to your Pi from the new account the tutorial writer had you create, and re-set the password for user pi. Once you're logged in as the other user (and assuming the tutorial writers didn't completely do you in):

$ sudo passwd --unlock pi

If you don't have the necessary privileges with your new account, the easiest/quickest thing to do is re-flash your SD card & start over.

Correct answer by Seamus on October 5, 2021

You need a computer with which you can read and write to the SD root filesystem (the second partition in Raspbian/RpiOS) for what I am suggesting.

Read this about how to disable the root password. This would allow you to login root and make whatever changes, such as passwd --unlock pi.

Answered by goldilocks on October 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP