3

I got a Raspberry Pi 3 which I got fully running, its running Debian with XFCE desktop. I knew it was possible to use X11 forwarding.

Now, my question, is it possible to start a program with one command? I want to create a desktop entry for my main OS (Ubuntu GNOME) so I can just click it and it will run.

I have to create a .sh file for this..

Is there a way to login and start a program with only ONE command? Let´s say I want to start GIMP.

Usually I do this:

ssh -XC -C -c arcfour,blowfish-cbc username@IP

Then it will open the SSH client for the RPi and ask for a password, then I type this in, and lastly I have to type in ¨Gimp¨ so it starts on my main desktop.

Is there a way I can do all of this with only ONE command? I want to make a desktop entry, but I dont want the terminal everytime to open up and ask for my password to login to the Pi.

7

Usually I do this:

ssh -XC -C -c arcfour,blowfish-cbc username@IP

Don't do that. Use -Y to make sure it will be working in future. Selection of "bad ciphers" does not help these days, nor the -C for compression.

ssh -Y username@IP

is just enough.

If you don't want to write all of them, there is ssh_config, where you can store entry like this:

Host pi
  Hostname <IP>
  User username
  ForwardX11 yes

and then you can connect simply by typing ssh pi.

To get rid of the password, prompt, it is good choice to set up public key authentication (in short):

ssh-keygen -t rsa
ssh-copy-id pi

Lastly, you can start the programs on the pi directly from ssh, such as

ssh pi gimp

which can be simply used as an shortcut for desktop, if you wish. But I think it is faster to type that, than search some icons on the desktop :)

6
  • Is it possible to share the whole XFCE taskbar onto my desktop? – OctaVIve Dec 25 '16 at 9:54
  • Not using X11 forwarding in SSH. – Jakuje Dec 25 '16 at 9:55
  • You could use ECDSA instead of RSA for the Pi. I recommend -t rsa -b 4096 for RSA keys (external), but for the Pi's I recommend -t ecdsa -b 521. – earthmeLon Dec 25 '16 at 17:32
  • Also, you might want to look into learning about and putting UsePubKeyAuthentication yes and IdentityFile /path/to/private.key in your ~/.ssh/config. – earthmeLon Dec 25 '16 at 17:34
  • Why are you suggesting -Y instead of -X? – OrangeDog Dec 25 '16 at 20:56
0

If you want the full desktop from the Pi you can install xnest, and use that. Xnest is a X client that is also a X server, so it gives you a second X server running as a sub-window in your current desktop.

I've set up a passwordless key to ssh to a vm with, and I've created a .ssh/config file with a shortcut as described by Jakuje so what I do is

user@host:~/ $ Xnest :1 &
user@host:~/ $ DISPLAY=:1 ssh myvm mate-session

This starts a Xnest "server" on my machine located at :1 (your regular display is :0), and sends that process to the background. Then I set my DISPLAY variable for that shell to point to the Xnest display, and ssh in to my vm using the info from my .ssh/config and starts a full MATE desktop session. Replace the mate-session with whatever command starts a desktop session on your remote machine.

3
  • I get this: XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed _XSERVTransMakeAllCOTSServerListeners: server already running (EE) Fatal server error: (EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE) – OctaVIve Dec 25 '16 at 17:24
  • What I also noticed, is that both monitors are Screen 0. Any way to make the second monitor Screen 1? – OctaVIve Dec 25 '16 at 17:35
  • @OctaVIve - that would require changing your xorg.conf (or whatever X server you are using) and may "separate" your dual monitor setup into 2 separate monitors... Your error could be because of how X is being started, each distro is a tad different. Open a terminal and do "set | grep DISPLAY" - it will tell you your default. Add 1 to whatever number is given. – ivanivan Dec 26 '16 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.