Newbie: X-session with ssh
FedoraForum.org - Fedora Support Forums and Community
Results 1 to 10 of 10
  1. #1
    mic_ Guest

    Newbie: X-session with ssh

    Hi all,

    Here I am new to the networking world. My problem is as follows.

    I have a Linux Enterprise computer and a Fedora Laptop. I would like to open a remote X-session using ssh (client: Fedora Laptop / server Lin. Ent. computer).

    I understand that once I logged into the server with ssh, their should not be any problem opening an X session. However, after succeding in logging in, that's what I get:

    [mic_@client mic_]$ ssh server_IP
    mic_@server's password:
    [mic_@server mic_]$ xeyes &
    [1] 6847
    [mic_@server mic_]$ _X11TransSocketINETConnect: Can't get address for localhost
    Error: Can't open display: localhost:10.0

    [1]+ Exit 1 xeyes


    It seems that somehow, the server thinks the client is called locallhost, which iis not the case as far as I know, since the HOSTNAME entry of /etc/sysconfig/network is client_name, and not localhost.

    I would be gratefull if someone could help me use a remote X terminal, through ssh.

    Thanks,

    Michel

  2. #2
    superbnerd Guest
    You really ouhgt to read the man pages for anything before you use it. This is a golden rule for linux (rtfm).

    The swtich you want is -X.
    Code:
    ssh -X user@host
    You should also make sure the sshd server has enabled X forwarding.

  3. #3
    mic_ Guest
    Hi, thanks for the answer.

    As a matter of fact, I did read the man pages, and the X11forwarding appears to be on (ForwardX11 yes in /etc/ssh/sshd_config). What you proposed still does not work, here's what I get:

    [mic_@client root]# ssh -X mic_@server
    mic_@server's password:
    [mic_@server mic_]$ xeyes &
    [1] 7081
    [mic_@server mic_]$ _X11TransSocketINETConnect: Can't get address for localhost
    Error: Can't open display: localhost:10.0

    [1]+ Exit 1 xeyes


    As I said previously, one thing I was thinking is that the server does not get the correct local host name (Error: Can't open display: localhost:10.0 from above). In particular, the client hostname is not localhost, but client, and I don't know where this comes from. Are there particular configuration files that should be checked ?

    Thanks,
    Michel

  4. #4
    olivierv Guest
    when you type
    Code:
    echo $DISPLAY
    what's the returned value? If it's blank, you need to set it. You may also want to try xhost + and then try again. If it works, the problem is with security issues (don't forget to do xhost - when done to re-enforce security).
    Last edited by olivierv; 14th October 2004 at 12:46 PM. Reason: I realize this is vague, but if you let me know what the above does then I'll go into more detail then instead of trying to cover all the bases now.

  5. #5
    mic_ Guest
    ok, it still doesn't work: I typed xhost + in the client (and the server as well), and set DISPLAY as follows
    [mic_@client mic_]# ssh -X mic_@server_IP
    mic_@server_IP's password:
    [mic_@server_IP mic_]$ echo $DISPLAY
    localhost:10.0
    [mic_@server mic_]$ export DISPLAY=client_IP:0.0
    [mic_@server mic_]$ echo $DISPLAY
    client_IP:0.0
    [mic_@server mic_]$ xeyes &
    [1] 7186
    [mic_@server mic_]$ Error: Can't open display: client_IP:0.0

    [1]+ Exit 1 xeyes
    so it still doesn't work ...

  6. #6
    olivierv Guest
    Ok,

    Try setting $DISPLAY to :0.0 or :10.0 omitting the localhost or IP prefix. What version of Linux is on the server? RHEL?

    Also, are you root when you ssh to the server? Are you root during any of this? I know that, for example, Suse doesn't automatically configure root to have X access after an su or su- (at least on Suse 9 and 9.1) and I've always had to do an export DISPLAY=:10.0 before running any X application as root.

  7. #7
    mic_ Guest
    Many thanks for your answers. The server is RHEL WS, the client Fedora 2.
    I tried everything as root and as a user, to no avail ...
    This is what I typed:

    [mic_@client mic_]$ ssh -X mic_@server_IP
    mic_@server_IP's password:
    [mic_@server mic_]$ echo $DISPLAY
    localhost:10.0
    [mic_@server mic_]$ export DISPLAY=:10.0
    [mic_@server mic_]$ echo $DISPLAY
    :10.0
    [mic_@server mic_]$ xeyes &
    [1] 7706
    [mic_@server mic_]$ Error: Can't open display: :10.0

    [1]+ Exit 1 xeyes
    [mic_@server mic_]$
    I also tried setting DISPLAY to :0.0, but still doesn't work, although the error message is different:
    [mic_@server mic_]$ export DISPLAY=:0.0
    [mic_@server mic_]$ echo $DISPLAY
    :0.0
    [mic_@server mic_]$ xeyes &
    [1] 7707
    [mic_@server mic_]$ Xlib: connection to ":0.0" refused by server
    Xlib: No protocol specified

    Error: Can't open display: :0.0

    [1]+ Exit 1 xeyes
    [mic_@server mic_]$
    any more ideas ?

  8. #8
    olivierv Guest
    Can you try setting $DISPLAY to :0.0 again and running xhost + on your FC2 box before logging in using ssh? Make sure you run xhost + as whatever user you're logged in to X as.

    So:
    Code:
    xhost +
    ssh -X rhelws_ip -l your_username
    export DISPLAY=:0.0
    xeyes
    If that doesn't work, try the last 2 steps with the previously mentioned DISPLAY values. When done, "exit" ssh and do a xhost +.

  9. #9
    superbnerd Guest
    Here is the easy solution:
    1) Use command gdmsetup, Main Menu > System Settings > Login
    2) Click the last tab XDMCP
    3) Enable XDMCP
    4) Enable Honour nderect request, the defaults should be acceptable for now
    5) Click the Security tab
    6) Uncheck the "Always disallow TCP connection to X server (disable all remote connection)"

    As a security messure, you should never allow root to login to ssh remotely. Make sure this option is in yout /etc/ssh/sshd_config
    Code:
    PermitRootLogin no
    To become root remotely, first login with a normal user. Then use the "su -" command to become root. You should also consider allowing only a certain user or group login remotely.

  10. #10
    mic_ Guest
    OK, finally it works ! Many thanks to both. I tried different combinations that you guys suggested. What was required was setting DISPLAY and the correct the login parameters (XDMCP, security etc.)
    So I guess I'll have to fiddle with the configuration files to have the DISPLAY settings done automatically.

    Here's what finally worked:
    [mic_@client mic_]$ ssh -X mic_@server_IP
    mic_@server_IP's password:
    [mic_@server mic_]$ export DISPLAY=client_IP:0.0
    [mic_@server mic_]$ xeyes &
    [1] 18521
    [mic_@server mic_]$
    Last edited by mic_; 15th October 2004 at 06:12 AM.

Similar Threads

  1. Replies: 2
    Last Post: 12th July 2008, 10:14 AM
  2. gnome-session-properties -> session list
    By fleshm in forum Using Fedora
    Replies: 0
    Last Post: 27th June 2007, 10:04 AM
  3. PHP Session ID (newbie)
    By weaved in forum Using Fedora
    Replies: 4
    Last Post: 19th March 2005, 03:13 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •