SFTP server

  • Hi all,

    I have a SFTP server (SSH access) which is for me the easiest way to configure it as it's simple to configure for macOS or Linux.

    I created a "kodi" account which gives access to my shared disk. I'm now trying to configure SSH to enable Kodi to connect without password (with IdentityFile).

    So I placed the "authorized_keys" file in kodi's .ssh folder on the server.

    Here's my ssh_config on LibreElec :

    Code
    LibreELEC:~ # cat .ssh/config
    Host     medias
    HostName medias-server
    User kodi
    IdentityFile /storage/.ssh/id_medias

    Here is my hosts on LibreElec :

    It's all OK, as I can connect with SSH in Terminal without password :

    Code
    LibreELEC:~ # ssh medias
    Last login: Fri Nov 29 15:04:47 2019 from 192.168.1.YYY
    MediasServer:~ kodi$


    Strangely, when I try to add sources from this server, I'm forced to use a password authentication. LibreElec recognize the host "medias-server" defined in .config/hosts.conf but not more the "medias" host which is defined in .ssh/config.

    In .kodi/userdata/sources.xml, this line works well, with user & password authentication :

    Code
    <path pathversion="1">sftp://medias-server:22//Volumes/Medias/Videos/Films/</path>

    But not this one :

    Code
    <path pathversion="1">sftp://medias//Volumes/Medias/Videos/Films/</path>

    Could you help me to configure my sources to use a IdentityFile autenthication ? Also, I'd like to Chroot user kodi in /Volumes/Medias/ but as I add this line in my server's sshd_config, libreelec can't connect no more :

    Code
    SSHD_CONFIG :
    [...]
    Match User kodi
        ChrootDirectory /Volumes/Medias/
        ForceCommand sftp
    [...]
    
    
    LibreELEC:~ # ssh medias
    packet_write_wait: Connection to 192.168.1.XXX port 22: Broken pipe

    Thanks for help.

  • Hi and thanks for your answer.

    I could try it, as when I connect with the name used in ~/.config/hosts.conf it works.

    But I think that if it don't understand the ~/.ssh/config 's Host, I'm afraid it won't use the identity file defined in the same config file.

    Is there another way to configure an IdentityFile in ~/.kodi/userdata/sources.xml ?

    About the Chroot, I thinks it's because of rights configuration :

    All components of the pathname must be root owned directories that are not writable by any other user or group

  • I have a SFTP server (SSH access) which is for me the easiest way to configure it as it's simple to configure for macOS or Linux

    I'm not sure which end you think is simple .. because from here is sounds like you made the whole thing wildly complicated. SMB is perfectly fine for domestic media use. SMB sources take ~30 seconds to setup.

  • Just, I have never been able to configure LE to use macOS's SMB share (it works only with SFTP), it was working OK only from Linux… but anyday without known reasons, it stopped working.

    It's why I'd like to use the same protocol for both, and SFTP is the one I understand best.