Change sshd_config option via cli

  • Hello there



    I am looking for a way to disable password auth via the commandline. I know there is an option in kodi, but i am trying to find out how to do it manually via the cli.

  • You have to edit /etc/ssh/sshd_config:

    Code
    1. PasswordAuthentication no

  • You have to edit /etc/ssh/sshd_config:

    Code
    1. PasswordAuthentication no


    That won't work. Please don't suggest things unless you have actually tried it.


    Code
    1. echo 'SSHD_DISABLE_PW_AUTH="true"' > /storage/.cache/services/sshd.conf
    2. systemctl restart sshd
  • That won't work. Please don't suggest things unless you have actually tried it.


    I did it and it works running kodi on ubuntu linux :exclamation:


    Please don't tell me I'm wrong unless knowing all facts.

  • I did it and it works running kodi on ubuntu linux :exclamation:


    Please don't tell me I'm wrong unless knowing all facts.


    Please try it on LibreELEC and report back


    LibreELEC != Ubuntu

  • I tried echo 'SSHD_DISABLE_PW_AUTH="true"' > /storage/.cache/services/sshd.conf on IMX6 and it didn't seem to work - so I ignored it. Now after a reboot I cannot ssh into it any more.


    on OSX (Darwin)
    ssh [email protected]
    Permission denied (publickey,keyboard-interactive).


    on Android JuiceSSH
    Just keeps asking for password which is still libreelec.


    Not sure if it is related as I removed the line from sshd.conf and the problem still exists. I've tried setting no password in Kodi and turning ssh on and off again but with no success.

  • I deleted /storage/.cache/services/sshd.conf and re-enabled ssh in Kodi and all worked as expected.
    However, setting "Disable SSH Password" caused the error to re-appear.


  • I deleted /storage/.cache/services/sshd.conf and re-enabled ssh in Kodi and all worked as expected.
    However, setting "Disable SSH Password" caused the error to re-appear.



    What error?

  • Permission denied (publickey,keyboard-interactive).



    That's not an error.


    Did you actually copy your public key to your device before disabling password authentication?

  • That's not an error.


    Did you actually copy your public key to your device before disabling password authentication?


    I didn't copy any key or anything. I just followed your suggestion. Now that its set back to "normal" I'm not going to bother any more - maybe it's a IMX6 thing.

  • I didn't copy any key or anything. I just followed your suggestion. Now that its set back to "normal" I'm not going to bother any more - maybe it's a IMX6 thing.



    I don't understand. What do you think that option is supposed to do?


    If you disable password auth then your only option is key based authentication in which case you actually have to copy your public key to your device (preferably using ssh-copy-id)

  • All I did is was followed YOUR suggestions and after that I couldn't ssh in any more.


    I'm not bothered but I have confirmed that setting "disable root access" causes the issue. On OSX, Ubuntu, Android, once set I cannot ssh into Le.


  • All I did is was followed YOUR suggestions and after that I couldn't ssh in any more.


    I'm not bothered but I have confirmed that setting "disable root access" causes the issue. On OSX, Ubuntu, Android, once set I cannot ssh into Le.



    I have no words.


    You couldn't ssh anymore because that command disables using a password when using ssh.

  • I have no words.


    You couldn't ssh anymore because that command disables using a password when using ssh.


    Has anyone told you that you're a dick?


    You play the "i'm so much better than you" crap, but you're too immature to see that not everyone has the same experience that you do.


    So instead of saying "Hey, you have to have some sort of authentication method, here's a URL for how key exchange works", you post this crap?


    Keep this in mind: There's always *someone* better/more experienced than you are.

  • I'm not sure why people are getting offended. Advice has been given politely and the advice is correct.


    I'll summarise the options for passwords/auth: If the "disable password auth" setting for SSH is enabled via LE settings or by adding extra config to the sshd.conf file (which is what LE settings does) the SSH daemon is still running and you can still SSH to the box and will receive a password prompt but the default root/libreelec credentials will not be accepted. To use key authentication instead of passwords you need to copy your public key to the box before disabling password auth so that private/public key auth can work (same as any other Linux distro). If you simply want to secure the box so that password login can't be used you can turn SSH off in LE settings and nobody can login. If you need access for something turn SSH back on again.


    Anything else is not possible .. so choose and calm down.