SSH - serving programs to thin clients

Tips and Tricks for Networking

Moderator: jkerr82508

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

SSH - serving programs to thin clients

Postby viking60 » 12 Sep 2010, 13:26

You will need a ssh server like openssh server. I am going to assume that you know how to set up SSH. (If you don't, ask in the help section and you will be guided)
Normally you ssh into your box with:

Code: Select all

ssh you@your-server
and provide a password and start using the CLI (Command Line Interface).
You can backup and sync your data and move and copy files - well what you can do in a CLI.
You can also start the GUI programs from the server on your clients :!:
Simply use this code:

Code: Select all

ssh -f -Y you@yourserver <program_you want_to _start>


So if your name is Barak and your server is called "washington" and you want to start netbeans, it would look like this:

Code: Select all

ssh -f -Y barak@washington netbeans

:A

So it is possible not only to centralize your files but also your programs.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
gnuuser
Berserk
Posts: 449
Joined: 18 Aug 2010, 21:52
Location: northwestern Pa.
Contact:

Re: SSH - serving programs to thin clients

Postby gnuuser » 13 Sep 2010, 17:37

good tip :dance:
thank you
registered Linux user number 505431
Amateur radio call sign KC3TEC
miracle (mere-ack-ull) :
the aspiration of the indigent, the expectation of the indolent, and the inspiration of the ignorant.

Im so old even dirt was my apprentice!

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: SSH - serving programs to thin clients

Postby viking60 » 13 Sep 2010, 21:02

Glad you liked it! I find it practical.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
mark9117
Junior Viking
Posts: 5
Joined: 14 Mar 2010, 21:38
Location: East Central New Mexico

Re: SSH - serving programs to thin clients

Postby mark9117 » 17 Jan 2011, 07:02

Just a quick suggestion here. If you like ssh and use it regularly, you might want to take a look at setting up passwordless ssh. There are a number of good tutorials out there. I just linked to the first one in my wiki.

I use ssh on my home lan and accessing that lan from work (shhh! Don't let IT know). Passwordless login is more secure than sending an unencrypted password across a net, it's faster, and it's more convenient than waiting on a prompt and fumble-fingering an actual password.

I should also say that I'm doing this from work with portable apps (PuTTY and KiTTY) and you have to use a key generator to get it to work, but it's still nearly hassle free.

Try it!

Mark
"Give a man a fire and he will be warm for a day. Set a man alight and he will be warm for the rest of his life."

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: SSH - serving programs to thin clients

Postby viking60 » 17 Jan 2011, 12:56

I'll give it a go - Thanks!
Yup that works fine! Here is what I did:
:A
On my local Mandriva box I typed:
1.

Code: Select all

ssh-keygen

I entered a passphrase.

2. I typed (on my Mandriva box):

Code: Select all

ssh-copy-id -i ~/.ssh/id_rsa.pub viking60-server

(That is where the magic happens and the key is moved to the Arch server from my Mandriva box)

3.I log in to the server

Code: Select all

ssh viking60-server

And I was asked for the passphrase -once.

After that I log in completely without a password.

Hmm I think I will write this up in a tip of its own. Or maybe you could? :think:
How do you reach your home lan - fixed IP? Dyndns?
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
rolf
Guru-Berserk
Posts: 1107
Joined: 16 Mar 2010, 16:07

Re: SSH - serving programs to thin clients

Postby rolf » 14 Apr 2011, 17:19

ssh -f -Y you@yourserver <program_you want_to _start>


Code: Select all

[rolf@localhost ~]$ ssh -f -Y [email protected] /usr/local/bin/ppm
[email protected]'s password:
[rolf@localhost ~]$ Error: Can't open display:
/usr/local/petget/filterpkgs.sh: line 91: kill: (32544) - No such process

(gtkdialog3:32575): Gtk-WARNING **: cannot open display:

[root@localhost rolf]# ssh -f -Y [email protected] /usr/local/bin/ppm
[email protected]'s password:
[root@localhost rolf]# Error: Can't open display:
/usr/local/petget/filterpkgs.sh: line 91: kill: (1119) - No such process

(gtkdialog3:1150): Gtk-WARNING **: cannot open display:


I get this when trying to start the Puppy package manager.

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: SSH - serving programs to thin clients

Postby viking60 » 14 Apr 2011, 19:17

Grr yes there must have been an update to openSSH. I have trouble here to getting anything to run now.
You could activate/add X11Forwarding yes in/etc/ssh/sshd_config on your puppy box. But I doubt it will help. It is supposed to be activated by default.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
rolf
Guru-Berserk
Posts: 1107
Joined: 16 Mar 2010, 16:07

Re: SSH - serving programs to thin clients

Postby rolf » 16 Apr 2011, 17:02

Tax times, busy times... :f Anywho

Code: Select all

# grep x /etc/sshd_config
#       $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $
# installations. In future the default will change to require explicit
#MaxAuthTries 6
#MaxSessions 10
# To disable tunneled clear text passwords, change to no here!
#ClientAliveCountMax 3
#MaxStartups 10
Subsystem       sftp    /usr/libexec/sftp-server
# Example of overriding settings on a per-user basis
# grep X /etc/sshd_config
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#       X11Forwarding no
#


I've had a glance at the sshd manual and am uncertain about how to configure for X. ISTR something about the wildcard * host being a little non-secure but not sure who everybody goes by on this mini-lan.
Off to the job, now. Thanks for looking in on me! Image

User avatar
dedanna1029
Sound-Berserk
Posts: 8784
Joined: 14 Mar 2010, 20:29
Contact:

Re: SSH - serving programs to thin clients

Postby dedanna1029 » 16 Apr 2011, 22:33

I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

User avatar
rolf
Guru-Berserk
Posts: 1107
Joined: 16 Mar 2010, 16:07

Re: SSH - serving programs to thin clients

Postby rolf » 19 Apr 2011, 06:20

On the thin client, where sshd is running, I changed two lines in /etc/sshd_config (I believe the commented lines are default configuration; I uncommented, switched no to yes, yes to no, following what the sshd_config manual said):

Code: Select all

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
X11UseLocalhost no
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no


Then `kill -1 <pid of sshd>` sends SIGHUP to sshd, causing it to restart and read the configuration anew. Now, time to rock and roll! :C

Code: Select all

[rolf@localhost ~]$ ssh -f -Y [email protected] /usr/local/bin/ppm
[email protected]'s password:
[rolf@localhost ~]$ /usr/bin/xauth:  creating new authority file /root/.Xauthority
X11 connection rejected because of wrong authentication.
X connection to puppypc:10.0 broken (explicit kill or server shutdown).
/usr/local/petget/filterpkgs.sh: line 91: kill: (19857) - No such process
X11 connection rejected because of wrong authentication.
The application 'gtkdialog3' lost its connection to the display puppypc:10.0;
most likely the X server was shut down or you killed/destroyed
the application.
:confused

Off to google on that authentication error, which gave me, among other things, this:
If you encounter X11 connection rejected because of wrong authentication error after logging to an UNIX/Linux host through ssh with X11 forwarding option, -X, check your /etc/inet/hosts file for multiple localhost entries; and remove the unnecessary ones.

For example, my /etc/inet/hosts has the following entries when the xclock failed with an X11 connection rejected .. error.

remotehost% cat /etc/inet/hosts

127.0.0.1 localhost
::1 localhost
10.2.211.150 sunfiret2000 loghost


Removing the 2nd line, ::1 localhost, fixed the issue.


In Puppy, Mandriva, too, I think there is /etc/hosts, which looked like this:

Code: Select all

127.0.0.1 localhost puppypc
192.168.1.1 pc2
192.168.1.2 pc3
192.168.1.3 pc4


On a hunch, I removed the 'puppyrc' entry and

Code: Select all

[rolf@localhost ~]$ ssh -f -Y [email protected] /usr/local/bin/ppm
[email protected]'s password:
[rolf@localhost ~]$


Image


:A Thanks for the tips and tricks! :s

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: SSH - serving programs to thin clients

Postby viking60 » 19 Apr 2011, 10:14

:B Thank you ! :s
And yes I belive the /ect/hosts is universal.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: SSH - serving programs to thin clients

Postby viking60 » 21 May 2011, 15:50

Ah this has been annoying me for some time now. And FINALLY I found the reason.
On the server side (the remote box):
In /etc/ssh/sshd_config I needed to forward X11.
Like this:

Code: Select all

.....
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes  <-----------!!!!!!!!!
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
......
                       

Bloody updates :f But now life is good again :cheers
restart X with

Code: Select all

sudo /etc/rc.d/sshd restart
(You might need to replace rc.d with init.d - or simply reboot).
....
Everything stars fine except netbeans where I have to use --jdkhome <path_to JDK>to locate jdk.
This is getting complicated to remember so I just tried a:

Code: Select all

ssh -X viking60@viking60-server

and entered netbeans in the terminal. That worked, in fact every GUI started fine like that.
Actually it works just fine without the -X too, so the setting in the sshd_config file did it all. :coffee_smile:
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"


Return to “Networking”