I'm connecting a button that user can click to restart the Raspberry Pi if he faced any problems, because of this I don't want the Raspberry Pi to ask for user name and password on every boot or restart!

Anyone can connect a screen, keyboard and mouse and then can have access to the Pi's data and files and make trouble for them, because of this I want the Raspberry Pi to ask for user name and password on every boot or restart!

In such a situation, what can I do? How can I avoid strangers access to my RPi, and at the same time keep the restart button (as it is very important)?

I know it's a very complicated question, but I still feel that there may be someone who has a workaround to solve such issue.

  • Just issue a password to the person authorized to press the button. Or, make sure your jobs are run at the system level whether or not anyone is logged in.
    – SDsolar
    Jan 10 '17 at 14:38

No, not in a secure way. You might be able to conditionally trigger an autologin based on something written to the root filesystem, but that is not secure -- all someone needs to do is figure out how to add the trigger manually to the SD card.

This could be mitigated against from a network perspective if you used the init system such that the trigger were only accessible to the root user and you modified the pi user's superprivileges from the Raspbian default, however, that seems pointless since from a network perspective after a restart, you would have to connect to the system again and that presumably means using some kind of credentials.

From a "physically there" perspective, the Pi, like most computers, is totally insecure anyway. It would be very easy for anyone with physical access to the pi to circumvent any security you add including passwords. An exception could apply to when the device is found off, if you encrypt the filesystem.

On normal computers you can mitgate against this by locking the case and removing any exposed bootable peripherals (or make them non-bootable), and/or use a BIOS password. The equivalent on the Pi would be to glue the SD card in, or use a lockable case which leaves it inaccessible.

  • Possibly worth mentioning the ability to disable the usb sockets in software - if it's to prevent casual interference that's probably enough to put off your average prodder.
    – goobering
    Oct 25 '16 at 14:55
  • @goobering I'm not sure what use the USB ports would be here unless you're using a Pi 3 configured to boot from such (which would mean not disabling them).
    – goldilocks
    Oct 25 '16 at 14:59
  • From the layout of the question I'm imagining something like a kiosk setup - needs a local on/off/restart option (or similar limited input), but needs to be 'secured' against unwanted inputs. Disabling USB would prevent end users from connecting common or garden input devices, limiting possible inputs to whatever's hooked up to GPIO.
    – goobering
    Oct 25 '16 at 15:30
  • Yeah I see what you mean now with the bit about "can can connect a screen, keyboard and mouse".
    – goldilocks
    Oct 25 '16 at 16:28
  • 1
    On the other hand, if you are just talking about an information kiosk where there is little to gain beyond causing mischief, you can secure it well enough physically to make it a sufficient deterrent to anyone just motivated by that. But if there could be a more substantial motive you need to restrict physical access purely to the input and output devices.
    – goldilocks
    Oct 26 '16 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.