Page 1 of 2

SSH - serving programs to thin clients

Posted: 12 Sep 2010, 13:26
by viking60
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.

Re: SSH - serving programs to thin clients

Posted: 13 Sep 2010, 17:37
by gnuuser
good tip :dance:
thank you

Re: SSH - serving programs to thin clients

Posted: 13 Sep 2010, 21:02
by viking60
Glad you liked it! I find it practical.

Re: SSH - serving programs to thin clients

Posted: 17 Jan 2011, 07:02
by mark9117
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

Re: SSH - serving programs to thin clients

Posted: 17 Jan 2011, 12:56
by viking60
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?

Re: SSH - serving programs to thin clients

Posted: 14 Apr 2011, 17:19
by rolf
ssh -f -Y you@yourserver <program_you want_to _start>


Code: Select all

[rolf@localhost ~]$ ssh -f -Y root@192.168.1.50 /usr/local/bin/ppm
root@192.168.1.50'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 root@192.168.1.50 /usr/local/bin/ppm
root@192.168.1.50'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.

Re: SSH - serving programs to thin clients

Posted: 14 Apr 2011, 19:17
by viking60
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.

Re: SSH - serving programs to thin clients

Posted: 16 Apr 2011, 17:02
by rolf
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

Re: SSH - serving programs to thin clients

Posted: 16 Apr 2011, 22:33
by dedanna1029

Re: SSH - serving programs to thin clients

Posted: 19 Apr 2011, 06:20
by rolf
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 root@192.168.1.50 /usr/local/bin/ppm
root@192.168.1.50'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 root@192.168.1.50 /usr/local/bin/ppm
root@192.168.1.50's password:
[rolf@localhost ~]$


Image


:A Thanks for the tips and tricks! :s

Re: SSH - serving programs to thin clients

Posted: 19 Apr 2011, 10:14
by viking60
:B Thank you ! :s
And yes I belive the /ect/hosts is universal.

Re: SSH - serving programs to thin clients

Posted: 21 May 2011, 15:50
by viking60
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: