Interactive startup script?

  • Hi there,

    I am trying to create an interactive startup script for LibreELEC. Specifically, I want to mount a folder using sshfs with password authentication (not key auth).

    I tried adding my commands to autostart.sh, but it looks like that is run in the background and Kodi gets started without prompting the user. Is there any way to execute a script with an interactive password input BEFORE Kodi gets started?

    Thanks for your help!

    -KJack

  • why?

    Because as a security architect, letting a non-encrypted, insecure device have SSH access to my NAS without a password makes my h.air stand on end. Anyone who got a hold of my SD card would have a certificate into my NAS. Not okay.

    I understand that LibreELEC doesn't support local OS encryption - this is the best alternative I can think of.

  • Because as a security architect, letting a non-encrypted, insecure device have SSH access to my NAS without a password makes my h.air stand on end. Anyone who got a hold of my SD card would have a certificate into my NAS. Not okay.

    I understand that LibreELEC doesn't support local OS encryption - this is the best alternative I can think of.

    You're using a distro that actively runs as root, has a locked root password and actively broadcasts an insecure webserver on port 80 and you are worried about your sd card getting stolen?

  • You're using a distro that actively runs as root, has a locked root password and actively broadcasts an insecure webserver on port 80 and you are worried about your sd card getting stolen?

    To each his own. No one's forcing you to agree with me.

    Still looking for an answer on this if anyone has one!

    Edited once, last by kjack9 (January 31, 2018 at 3:13 PM).

  • For any future dwellers looking to do password-based authentication for SSHFS shares, I have created a super-simple addon that will take care of this for you. It uses SSHFS from LibreELEC Network Tools to create a native (non-Kodi) SSHFS mount using password-based authentication.

    The addon .zip is attached to this post.

    Install

    Install addon from .zip file, select the downloaded zip

    LibreELEC Network Tools is a dependency. If you do not already have it installed, it will be installed for you. You will need to restart your box before you can use SSHFS Password Mount if Network Tools was not previously installed. If you don't, you'll get an error.

    Configuration

    The configuration for the addon must be completed in Kodi before running the script. The options are pretty self-explanatory.

    Username - the SSH username to connect to the SSH server with

    Hostname - the hostname or IP address of the SSH server you want to connect to

    Remote Path - the directory on the remote host that you want to connect to (like /media/movies)

    Local Path - the directory on the local host that you want to mount the connection into (like /storage/sshfs)

    Trigger video library update on success - runs a video library scan after successfully mounting the share

    Trigger music library update on success - runs a music library scan after successfully mounting the share

    I recommend disabling library scans for video and music on Kodi startup, and instead enable the appropriate options above.

    Using

    Once configured, simply run the addon. It will ask you for a password and then attempt to mount the share. It will let you know if there's a problem.

    Now you can add the new share to your video/music library by browsing to the directory you set in 'Local Path'.

    Autostart

    If you want this script to auto-start when Kodi starts, SSH into your box and execute the following...

    Code
    echo "import xbmc" >> ~/.kodi/userdata/autoexec.py
    echo "xbmc.executebuiltin('RunScript(script.sshfs-pw-mount)')" >> ~/.kodi/userdata/autoexec.py

    The SSHFS Password Mount password dialog will now pop up as soon as Kodi starts.

    I hope this helps someone!

    -KJack