LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-07-2011, 03:10 PM   #1
youarefunny
Member
 
Registered: Mar 2010
Distribution: Arch Linux, FreeBSD
Posts: 31

Rep: Reputation: 0
Problem with SSH from xinitrc


I am trying to have a sort of 'thin client' computer to display programs that are run on a more powerful computer over SSH. (standard ssh stuff). Anyway, when I run xinit and then ssh -X remote@123.123.1.9 all works beautifully. But I want to have it automaticly (without user input). xinit -e 'ssh -X remote*123.123.1.9' also works nice. The only problems with these two methods are the login xterm. So I went to startx because it doesn't have an xterm (i think). But, when I put the ssh login command in /etc/X11/xinit/xinitrc it doesn't work. It just hangs. Although, I have noticed that, although users doesn't say remote is logged in, ps -e remote says he is running sshd untill I kill the X server (it just displays black).

So, what am I doing wrong or what is a better / the proper way to achieve this?

If it helps:
Server 64bit Arch Linux up-to-date
Client 32bit Ubuntu 10.04 LTS

Thanks for your time.
 
Old 05-08-2011, 01:02 AM   #2
plpl303a
Member
 
Registered: May 2011
Posts: 52

Rep: Reputation: 3
When you do the ssh from the console, does it prompt for a password? If ssh is hanging, perhaps it's waiting for a password.

You can also give the flags

-n -N

and indeed, you probably want to do that, as well as backgrounding the command:


ssh -n -N -X username@machinename &
 
Old 05-09-2011, 07:15 AM   #3
youarefunny
Member
 
Registered: Mar 2010
Distribution: Arch Linux, FreeBSD
Posts: 31

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by plpl303a View Post
When you do the ssh from the console, does it prompt for a password? If ssh is hanging, perhaps it's waiting for a password.

You can also give the flags

-n -N

and indeed, you probably want to do that, as well as backgrounding the command:


ssh -n -N -X username@machinename &
I tried all these things to no avail.

-N causes it to return right away (makes sense)
-n does nothing new (still "hangs")

starting it in the background causes startx to shutdown the X server right away.

Thanks for the help. Do you have any more suggestions or a idea of what might be causing it?
 
Old 05-09-2011, 10:21 PM   #4
plpl303a
Member
 
Registered: May 2011
Posts: 52

Rep: Reputation: 3
Would using vnc be a possibility? That would also fit in with the "thin client" paradigm. It also creates its own private X desktop.

One other question: Are you trying to run just a single X client remotely and display locally or are you trying to display *all* remote X clients locally?

If it's the latter, I don't think startx is designed to do that -- When startx runs, it tries to initialize the display adapter on the system it's running on. So if you ssh to a system and then run startx on that system, the startx program will initialize the display on the remote computer.

If you don't like the xterm, perhaps creating a ~/.xinitrc that runs some program that just sits forever would be helpful (since xinit looks for ~/.xinitrc and if it doesn't find it, it runs xterm. If you create an xinitrc, then xinit will run the programs listed there, and the X server will terminate when the last program in xinitrc exits).
 
Old 05-10-2011, 07:04 AM   #5
youarefunny
Member
 
Registered: Mar 2010
Distribution: Arch Linux, FreeBSD
Posts: 31

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by plpl303a View Post
Would using vnc be a possibility? That would also fit in with the "thin client" paradigm. It also creates its own private X desktop.
I have thought about this but it appears to take more resources. Also the screen doesn't update nicely (it flickers). I may have to use this but I was hoping I could get it working with raw X.

Quote:
Originally Posted by plpl303a View Post
One other question: Are you trying to run just a single X client remotely and display locally or are you trying to display *all* remote X clients locally?
I don't quite get the question. I have one computer right now but if I can figure this out I would like to connect more. I want one X server up on each 'branch' connecting to one login with a full desktop session running on the 'central' computer.

Quote:
Originally Posted by plpl303a View Post
If it's the latter, I don't think startx is designed to do that -- When startx runs, it tries to initialize the display adapter on the system it's running on. So if you ssh to a system and then run startx on that system, the startx program will initialize the display on the remote computer.
I'm sorry for being unclear, I am running startx on the remote computer to start and X server and then ssh to the 'central' computer that will run all of the clients.

Quote:
Originally Posted by plpl303a View Post
If you don't like the xterm, perhaps creating a ~/.xinitrc that runs some program that just sits forever would be helpful (since xinit looks for ~/.xinitrc and if it doesn't find it, it runs xterm. If you create an xinitrc, then xinit will run the programs listed there, and the X server will terminate when the last program in xinitrc exits).
This sounds like a game winner. I will try this out and see how it goes. I thought the xterm was just a 'byproduct' of xinit that is nice for debugging but not for the average desktop user. I'll get back to you as soon as I get a chance to try this out.
 
Old 05-10-2011, 03:41 PM   #6
youarefunny
Member
 
Registered: Mar 2010
Distribution: Arch Linux, FreeBSD
Posts: 31

Original Poster
Rep: Reputation: 0
Thank you. You have helped me to figure this out. It turns out that when ssh is not running interactively bash is not called. You can solve this by calling bash (or any program) via ssh
Code:
ssh -Xn user@host bash
ssh -Xn user@host desktop-session
 
  


Reply

Tags
networking, ssh, startx, xinit, xorg



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Chroot SSH problem: ssh working, not SFTP & SCP. NaCo Linux - Security 3 02-01-2009 02:23 AM
Problem xinitrc, Gnome starts instead of KDE McCloud Debian 7 09-05-2004 08:03 AM
.xinitrc problem reddazz Slackware 4 08-12-2004 07:33 AM
.xinitrc problem cruelnovember Linux - Software 3 06-14-2004 08:50 AM
Blackbox and .xinitrc problem firefly2442 Linux - Software 5 10-23-2003 11:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration