Shortcut to connect ssh and then open NoMachine

Forum / NoMachine for Linux / Shortcut to connect ssh and then open NoMachine

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #27194
    walttheboss
    Participant

    Kubuntu 18.04.4, NoMachine 6.9.2

    I am using NoMachine Free with SSH tunnel. I want to make a shortcut or script that automated the process.  I have tried the below methods.  All processes work individually. But to simplify my life I want one shortcut to dial and then connect and then open.

    ssh -T -L 4102:localhost:4000 xxxxx@xxxxx  && sleep 5s && /usr/bin/xdg-open /home/acer/Documents/NoMachine/Exodus_ZT.nxs

    ssh -T -L 4102:localhost:4000 xxxxx@xxxxx  && sleep 5s && /usr/NX/bin/nxplayer.bin /home/acer/Documents/NoMachine/Exodus_ZT.nxs

    Can anyone help with this non-essential task?

    Thanks in advance.

    Walt

     

    #27222
    walttheboss
    Participant

    OK after invoking the gods of admitting to losing your keys and then they immediately appear, I have the solution.

    1. Dial and then put the ssh into the background. That allows you to enter commands on the current machine
    2. Sleep for a bit to let the ssh connection work.
    3. Open the NoMachine session.

    ssh -fN -L 4102:localhost:4000 user@remotehost  && /bin/sleep 5s &&  /usr/bin/xdg-open /home/acer/Documents/NoMachine/Exodus_ZT.nxs

    I would mark this as solved but do not know how.

    Walt

     

    #27339
    Britgirl
    Keymaster

    Thanks for letting us know. You could have also changed:

    /usr/bin/xdg-open /home/acer/Documents/NoMachine/Exodus_ZT.nxs

    to:

    /usr/NX/bin/nxplayer --session /home/acer/Documents/NoMachine/Exodus_ZT.nxs

Viewing 3 posts - 1 through 3 (of 3 total)

This topic was marked as solved, you can't post.