Wiki/HowTo about SSH setup without password (using public key)

  • In the last 2 days I've been spending a lot of time googling and searching EL + OE forums to figure out how to setup [passwordless] SSH access to LibreELEC box using public key.

    As I see in forums, different people keep hitting this wall, too.

    I would be more than happy to create a HowTo or Wiki entry about it (whichever is preferred), if there is no public how to available already. Just to save time for other people.

    Could you help me by directing me to the right people who could involve me in the HowTo creation.

    Cheers,

    WolfDog

  • Go to Best Answer
  • Of course it works.

    A few reasons why in my case it didn't worked:

    • OpenELEC documentation - took me a while to understand that I need to "mix" OpenELEC and LibreELEC documentation to understand whatever I need to understand for LibreELEC
    • needs some deciphering if you would like to:
      • connect from Windows box, for ex using putty - in that case you need to copy your private key to the "other" box
      • generate your keys on Windows, for ex using putty
    • misses some points like:
      • don't try to change /etc/ssh/sshd_config because that part is readonly
      • what should you change if you want to additionally fine-tune your sshd config (typically he staff listed in sshd_config)
      • systemd is used, so "systemctl restart sshd" should be used if you want to restart sshd (and not "service sshd restart" or not "/etc/init.d/sshd restart")
  • I'd like to add to this post for people attempting to configure Putty for connecting from a Windows environment. The information is here and there but seemingly not all in one place. The following steps got me (a linux ignoramus) going:

    If you are here, it is assumed that you already have Putty installed and know how to login to LE SSH. WinSCP will be a required download.

    1. Generate/Save Public and Private Keys (.pub and .ppk) with PuttyGen (Included with Putty)

    2. Copy Public Key (.pub) to LE (/storage/.ssh) with WinSCP (Show Hidden files In 'Options \ Preferences \ Panels \ Common')

    3. Use Putty to Run the following commands in SSH session:

    Code
    ssh-keygen -i -f ~/.ssh/key.pub > ~/.ssh/authorized_keys
    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/authorized_keys


    4. Configure/Save new Putty Session:

    • Enter Host\IP
    • Navigate to 'Connection\Data' and enter 'root' for 'Auto-login username'
    • Navigate to 'Connection\SSH\Auth' and click 'Browse' to select previously generate private key (.ppk)
    • Navigate back to 'Session' and specify a Session Name before clicking 'Save'

    5. Disable SSH Password in Kodi LE Settings

    The saved session in Putty should connect at this point using the Public/Private key combination.

    I hope this provides useful reference for others as this thread was one of the first Google hits when I searched for instructions. Beyond that, I now have reference for when I forget how to do this :)

    Edited 2 times, last by TDown (April 26, 2018 at 6:11 PM).