enable and disable ssh password from the terminal (headless)

  • I connect to a remote RPi 2 with LE7 using ssh. Everything is well. I can connect using pwd and ssh in using the secure way. Pwd access is then turned off. RPi is programmed to control the modem to ensure that the Internet is always working.

    But, I would like to be able to enable password login and disable it should the need arise. It is a remote headless device. So, I must do it from the terminal over ssh.

    • Official Post

    Try setting SSHD_DISABLE_PW_AUTH="true" in /storage/.cache/services/sshd.conf and run "systemctl restart sshd.service" to bounce the daemon and reload the new config.

  • Try setting SSHD_DISABLE_PW_AUTH="true" in /storage/.cache/services/sshd.conf and run "systemctl restart sshd.service" to bounce the daemon and reload the new config.

    Thanks, I belive that will do it!

    I have had today another shock when I discovered that the stupid chinese ZTE modem/router at that location does not provide port forwarding from a port X to a port Y (just forward port X to the IP address), I was lucky enough to find excellent #5 post setting ssh port and noticed that settiong there. Thanks for confirming it.

    Stupid problems: I live on an island and when the sun hits us, my provider damage data (entire summer). So, I may have problems connecting using anything "longer" (such as the ssh key) as it may get damaged. That was not enough, but they have internal routing error which breaks their routing wihtin their network so I can not use VPN whenever we get address from a range 109.227.*.*. So, a RPi will be fixing these problems until they sort them out. ssh is for me to manage it remotely.

  • Just wanted to note, it looks like you may have to toggle two things in the file (/storage/.cache/services/sshd.conf) in order to disable ssh password running LIbreelec 9 Alpha (LibreELEC (Leia) v8.90.006 ALPHA)

    When i just toggled the 'false' to 'true', i could still log in using password

    Looking in that file while toggling through the GUI, i see the following changes:

    SSHD_DISABLE_PW_AUTH="false"

    SSH_ARGS=""

    SSHD_DISABLE_PW_AUTH="true"

    SSH_ARGS="-o 'PasswordAuthentication no'"

    Hope this helps someone