1

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

gumby4231
  • 55
  • 6
  • 3
    Whatever you have done NEEDS to be in your question, NOT a "tutorial" which has given you questionable advice. – Milliways Jul 20 '20 at 22:22
  • @ Milliways @AnonyoZarif I should have been more clear. That is my mistake. The tutorial did not suggest making a new account is a vital step to controlling the computer via ssh. They merely suggested that leaving the default account/password active whilst the Pi allowed for ssh control was a safety concern. Is it true that changing the password for the Pi account would have sufficed, yes. Making a whole new account was unnecessary and I'm probably guilty of blindly following advice. – gumby4231 Jul 21 '20 at 14:37
  • @Milliways In defense of my question, my intension in linking the tutorial and talking about ssh was just to provide context. My real questions are explicitly stated at the bottom. I was not asking people to go to the tutorial and comment on the procedure. That being said if you both feel as though the post should be edited as to include all steps followed, no problem. I acknowledge that this post is not merely to help me, but to help establish documentation for people researching in the future. I am no expert on the Pi, nor on this forum. Thanks for your time – gumby4231 Jul 21 '20 at 14:52
  • @gumby4231 Hey, I hope our comments didn't hurt you. Your question was great. But it's good to and you should add everything in your post itself. And I understand the reason you added the link. But please remember, you should follow the rules of the forum. And I'm sorry if something hurt you. Happy RPi-ing! – AnonyoZarif Jul 21 '20 at 19:45
  • @AnonyoZarif Thanks for your concern. If my post isn't following the rules/isn't helpful, it is appropriate for you all to inform me of the flaws. I'll edit it tomorrow and write all the steps I followed. Additionally, I would like add that for someone new to the Pi world, forums like this have been very useful for learning. – gumby4231 Jul 21 '20 at 23:11
  • @gumby4231 Yes you're right. And I'm not insisting to edit the post. But It'll be good if you do. It'll help others as you said, without going outside the StackExchange network. And thanks in advance, for helping others. – AnonyoZarif Jul 22 '20 at 12:05

2 Answers2

6

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.

Seamus
  • 18,728
  • 2
  • 27
  • 57
  • I have followed these steps and it worked. I have changed the password and now have access to the raspberry pi account. Thanks – gumby4231 Jul 21 '20 at 16:06
  • @gumby4231: I'm glad it helped. If it resolved the issue, you may select this as the correct answer - just tick the check mark next to it, and it will turn green. [Here's a guide.](https://raspberrypi.stackexchange.com/help/someone-answers) – Seamus Jul 21 '20 at 17:19
1

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.

goldilocks
  • 56,430
  • 17
  • 109
  • 217