Skip to Content
  • +31 653-919-302
Cafayate.Net
  • 0
  • 0
  • Sign in
  • Nederlands English (US) Español (AR)
  • Contact Us
  • Home
  • Blog
  • Jobs
  • Contact us
Cafayate.Net
  • 0
  • 0
    • Home
    • Blog
    • Jobs
    • Contact us
  • +31 653-919-302
  • Nederlands English (US) Español (AR)
  • Sign in
  • Contact Us

Using LXD remote with ssh port forward

  • All Blogs
  • Tech Blog
  • Using LXD remote with ssh port forward
  • March 5, 2021 by
    Administrator

    This one came to me, while using LXD on a test server i have. LXD 2.0 stable is one of the great things that came with Ub untu 16.04LTS. I follow this project for a while and always waiting for the right time to be able to use it.

    I have been using this for 2 months and i have no complains, so far. It’s stable as the word says. The usual method is to ssh into my test server and there i use lxc to manage my containers.

    So i just do:

    # Create a SSH tunnel to your laptop
    ssh [email protected]
    
    # Use it
    lxc list
    lxc exec odoo1 bash
    (many other available lxc commands ...)
    

    Now i recalled that even no being on the same local network i can register the remote LXD daemon on the local interface 127.0.0.1 using a different port than the default 8443.

    For this to be possible, we just need to set it up on the LXD server first:

    lxc config set core.https_address "[127.0.0.1]:9443"
    lxc config set core.trust_password some-password
    

    Now, we need to add the remote on our laptop:

    # You need at least to have lxd-client tools
    sudo apt install lxd-client
    
    # Add the remote LXD server on our laptop
    lxc remote add test 127.0.0.1:9443
    
    # Create a SSH tunnel to your laptop
    ssh -NL 9443:localhost:9443 [email protected]
    
    # Try it out
    lxc list test:
    lxc exec test:odoo1 bash
    

    Now imagine how much easier is to use a lxc file pull/push running lxc on your local…

    in Tech Blog
    Nginx: Block URL Access (wp-admin/wp-login.php) To All Except One IP Address

    Designed for companies

    We are a team of passionate people whose goal is to improve everyone's life through disruptive products. We build great products to solve your business problems. Our products are designed for small to medium size companies willing to optimize their performance.

    Get in touch

    Plantexel
    Pedernera
    Salta Capital 
    Argenina

    • +31 653-919-302
    • [email protected]
    Follow us
    Copyright © Plantexel
    Nederlands | English (US) | Español (AR)