Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.

SSH client from inside app container

  • I need to transfer data from a linux server to the data directory of a Cloudron app. Figured I'd do so server-to-server with scp.

    1. I've managed to generate a keypair and use it with the -i flag, since /root/.ssh isn't writable. Did so with ssh-keygen -t rsa -b 4096, saving it to /app/data/ssh
    2. I've put the public key in the other server's authorized_keys.
    3. I've also used -o to use a custom known_hosts file.

    Still, I get this:

    Could not create directory '/root/.ssh'.
    Load key "/app/data/ssh/": invalid format
    user@IP: Permission denied (publickey).

    How can I get it working?

  • Staff

    The ssh server is running on the linux host not inside the app as such. So in your case you would have to scp to the server itself and the destination for the files would be something like /home/yellowtent/appsdata/<appid>/data/ where appid can be obtained for example via the dashboard in the app configure view (it is the id shown in the url bar of the browser and looks like 2044032d-2f56-4c84-926f-7a1ec272f7f1)
    Generally this flow is not great usability wise and you have to be careful what to overwrite with this inside the app data. Also to ensure filesystem permissions are correct, you have to restart the app afterwards.

    Can you maybe explain the actual use-case for this and maybe there is an alternative process to get data inside the app?

  • Staff

    In the container, you can always do:

    ssh-keygen -f /run/bling.key # this generates /run/ and /run/bling.key
    scp -i /run/bling <args>

  • Ah yes, it didn’t even occur to me that I could just scp from box the whole time. Somehow I’ve compartmentalized the app data to be not reachable from the host system when in fact it easily is. 🤦♂

    I’m migrating a WP site. I know that there are other ways too 🙂

  • It proved a decent strategy given I get 50MB/s in a direct server-to-server transfer instead of caching it on my computer at a speed of 3MB/s.

Log in to reply