Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dukebound85

macrumors Core
Original poster
Jul 17, 2005
19,131
4,110
5045 feet above sea level
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
Warning: Unrecognized MATLAB option "x".
Warning: No display specified. You will not be able to display graphics on the screen.
and am limited to the terminal interface

Any ideas?

Thanks
 

bradl

macrumors 603
Jun 16, 2008
5,923
17,399
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

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.
 

dukebound85

macrumors Core
Original poster
Jul 17, 2005
19,131
4,110
5045 feet above sea level
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!
 

bradl

macrumors 603
Jun 16, 2008
5,923
17,399
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!

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.
 
  • Like
Reactions: amitroy

dukebound85

macrumors Core
Original poster
Jul 17, 2005
19,131
4,110
5045 feet above sea level
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))

# $OpenBSD: sshd_config,v 1.81 2009/10/08 14:03:41 markus Exp $

# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# 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.

#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
#Protocol 2

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Logging
# obsoletes QuietMode and FascistLogging
SyslogFacility AUTHPRIV
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords both PasswordAuthentication and
# ChallengeResponseAuthentication must be set to "no".
#PasswordAuthentication no
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
# Also, PAM will deny null passwords by default. If you need to allow
# null passwords, add the " nullok" option to the end of the
# securityserver.so line in /etc/pam.d/sshd.
#UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none

# pass locale information
AcceptEnv LANG LC_*

# no default banner path
#Banner none

# override default of no subsystems
Subsystem sftp /usr/libexec/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# ForceCommand cvs server

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?
 

bradl

macrumors 603
Jun 16, 2008
5,923
17,399
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.
 

dukebound85

macrumors Core
Original poster
Jul 17, 2005
19,131
4,110
5045 feet above sea level
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.

change on my remote machine correct?

thanks for the assistance:)
 

dukebound85

macrumors Core
Original poster
Jul 17, 2005
19,131
4,110
5045 feet above sea level
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
 

bradl

macrumors 603
Jun 16, 2008
5,923
17,399
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

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.
 

amitroy

macrumors newbie
Apr 4, 2016
1
0
kanpur
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.