ssh and x11

Discussion in 'Mac OS X Lion (10.7)' started by dukebound85, Jun 17, 2012.

  1. dukebound85 macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #1
    I am trying to ssh into my work computer using x11 to allow the application to display on my computer at home

    I have done
    ssh -X host_computer

    Once I am logged into my machine, I have tried

    matlab -X

    Instead of having the matlab GUI pop open on my screen, I get
    and am limited to the terminal interface

    Any ideas?

    Thanks
     
  2. bradl macrumors 68040

    bradl

    Joined:
    Jun 16, 2008
    #2
    Going to ask the obvious questions here..

    After you get logged in, what does "echo $DISPLAY" tell you? You should get something back at least with :0 at the end.

    Do any other simple X11-based apps work? Xeyes? Xlogo? Xcalc? If they work after using ssh -X, then it's down to matlab, and the right options being passed to it. Is -X the right option? If the former doesn't work, is X11Forwarding set to "No" in /etc/ssh/sshd_config? If it is, switch that to yes, followed by a restart of the ssh daemon. It looks like by default (at least in Lion) that it is set to no.

    BL.
     
  3. dukebound85 thread starter macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #3
    echo $Display outputs a blank line and then the prompt signal again

    the other programs give me an error stating that the display can't be opened

    -X has worked on other machines with matlab (school servers) but not my work machine

    is that X11forwarding on my home machine or the one I am logging into that needs to be set?

    Thanks for the help!
     
  4. bradl macrumors 68040

    bradl

    Joined:
    Jun 16, 2008
    #4
    Got it.. so that means that the options to matlab are fine. Now it's the server.

    Have a look at /etc/sshd_config on the server you are connecting to (that should be your home machine). Here's what mine looks like, with the important comments from the top (I haven't edited mine:)

    Code:
    # The strategy used for options in the default sshd_config shipped with
    # OpenSSH is to specify options with their default value where
    # possible, but leave them commented.  Uncommented options change a
    # default value.
    
    #X11Forwarding no
    
    This means that by default, X11Forwarding is not allowed. You'll have to uncomment that line, set it to yes, and restart sshd (killall -HUP sshd will work as well).

    Note that switching X11Forwarding here will make it happen globally for every user on your machine. If you really want to be secure, append something like the following to sshd_config:

    Code:
    # Example of overriding settings on a per-user basis
    Match User <your username here>
           X11Forwarding yes
           AllowTcpForwarding yes
    
    This will allow it to only be enabled for your username, not everyone globally. The above should be able to be dropped directly into your sshd_config file. You will still need to restart sshd for this to take effect.

    BL.
     
  5. dukebound85 thread starter macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #5
    Here is what mine looks like on the machine that is local to me (/etc/sshd_config......though etc was an alias in my root folder (had a black arrow))

    Seems I have multiple X11forwarding lines. Does it matter which one I edit?I bolded the occurances

    I would change it on this machine (one I am typing on, or the one I am ssh'ing into?) I assume the one I am ssh'ing into right?
     
  6. bradl macrumors 68040

    bradl

    Joined:
    Jun 16, 2008
    #6
    Looks like yours is the default.

    Quickest way to handle it is to uncomment the first X11Forwarding line, change "no" to "yes", then restart sshd. That will handle it globally, so if you have more than one user who uses ssh to connect to your machine, they'll also be able to use X-based apps as well. If that's acceptable to you, then you're all set.

    BL.
     
  7. dukebound85 thread starter macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #7
    change on my remote machine correct?

    thanks for the assistance:)
     
  8. bradl macrumors 68040

    bradl

    Joined:
    Jun 16, 2008
    #8
    Yep.. on the remote machine. not the one you are issuing the ssh command on.

    BL.
     
  9. dukebound85 thread starter macrumors P6

    dukebound85

    Joined:
    Jul 17, 2005
    Location:
    5045 feet above sea level
    #9
    ok another question. I cant seem to edit that file. I am an admin on both machines. I edit, saves as a duplicate and trying to move that duplicate file and then overwrite the existing file sshd_config
     
  10. bradl macrumors 68040

    bradl

    Joined:
    Jun 16, 2008
    #10
    You'll have to do it as root (read: superuser).

    for the editor you like to use, do a sudo <editor> /etc/sshd_config and make the changes. The file is owned by root, which is why you can read it, but not make changes to it.

    BL.
     
  11. amitroy macrumors newbie

    amitroy

    Joined:
    Apr 4, 2016
    Location:
    kanpur
    #11
    I am facing a similar problem wherein i am able to access matlab server running on my universities machine from my laptop running el captain. But the matlab is running without graphics and with error
    [code\]
    $matlab

    Warning: No display specified. You will not be able to display graphics on the screen.

    Warning: No window system found. Java option 'Desktop' ignored.


    < M A T L A B (R) >

    Copyright 1984-2013 The MathWorks, Inc.

    R2013a (8.1.0.604) 64-bit (glnxa64)

    February 15, 2013


    No window system found. Java option 'Desktop' ignored.
    [\code]
    i am able to use the same matlab server with graphics on my another laptop running ubuntu.
    However the same is not work in el captain. how to change ssh configuration for local machine to accept -X argument.
    i have edited my /etc/ssh/sshd_config for X11 forwarding by uncommenting and selecting yes. However it doesn't work.
     

Share This Page