Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
603 views
in Technique[技术] by (71.8m points)

linux - set-up X11 Forwarding over ssh

I'm attempting to set up x11 forwarding to monitor video on an embedded robotics platform yet I cannot seem to get the board to generate graphical output. I'm running Arch Linux on a Beagleboard xM wired directly over ethernet (though, I plan to use WiFi in the future). When I try to set the DISPLAY variable it will accept it but when I attempt to run an x11 application is says:

(Object:287): Gtk-WARNING **: cannot open display: [displaynamehere]

obviously [displaynamehere] was whatever I tried to set as the display, yet no display location seemed to work. What's weird is that whenever I connect through ssh -X it does not give me any errors and it does not save my DISPLAY variable.

(EDIT) I also checked the debug log and got this output:

debug2: load_server_config: filename /etc/ssh/sshd_config
debug2: load_server_config: done config len = 315
debug2: parse_server_config: config /etc/ssh/sshd_config len 315
debug3: /etc/ssh/sshd_config:53 setting AuthorizedKeysFile .ssh/authorized_keys
debug3: /etc/ssh/sshd_config:75 setting ChallengeResponseAuthentication no
debug3: /etc/ssh/sshd_config:96 setting UsePAM yes
debug3: /etc/ssh/sshd_config:101 setting X11Forwarding yes
debug3: /etc/ssh/sshd_config:104 setting PrintMotd no 
debug3: /etc/ssh/sshd_config:108 setting UsePrivilegeSeparation sandbox     
debug3: /etc/ssh/sshd_config:124 setting Subsystem sftp /usr/lib/ssh/sftp-server
debug1: sshd version OpenSSH_6.3, OpenSSL 1.0.1e 11 Feb 2013
debug3: Incorrect RSA1 identifier
debug1: read PEM private key done: type RSA
debug3: Incorrect RSA1 identifier
debug3: Could not load "/etc/ssh/ssh_host_rsa_key" as a RSA1 public key
debug1: private host key: #0 type 1 RSA
debug3: Incorrect RSA1 identifier
debug1: read PEM private key done: type DSA
debug3: Incorrect RSA1 identifier
debug3: Could not load "/etc/ssh/ssh_host_dsa_key" as a RSA1 public key
debug1: private host key: #1 type 2 DSA
debug3: Incorrect RSA1 identifier
debug1: read PEM private key done: type ECDSA
debug3: Incorrect RSA1 identifier
debug3: Could not load "/etc/ssh/ssh_host_ecdsa_key" as a RSA1 public key
debug1: private host key: #2 type 3 ECDSA
debug1: rexec_argv[0]='/usr/bin/sshd'
debug1: rexec_argv[1]='-ddd'
debug3: oom_adjust_setup
Set /proc/self/oom_score_adj from 0 to -1000
debug2: fd 3 setting O_NONBLOCK
debug1: Bind to port 22 on 0.0.0.0.
Bind to port 22 on 0.0.0.0 failed: Address already in use.
debug2: fd 3 setting O_NONBLOCK
debug3: sock_set_v6only: set socket 3 IPV6_V6ONLY
debug1: Bind to port 22 on ::.
Server listening on :: port 22.

Any suggestions would be greatly appreciated, I've been trying at this with google for almost a week now to no avail.

Thanks a lot!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

On the server

Edit /etc/ssh/sshd_config:

AllowAgentForwarding yes
AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost no

Restart the sshd daemon:

sudo service sshd restart
# or
sudo /etc/init.d/ssh restart
# or whatever way of restarting your box services works on your distro...

Install the packages (Ubuntu/Debian):

apt-get -y update
apt-get -y install xauth

Install the packages (RHEL/CentOS):

yum -y update
yum -y install xauth

Now exit the server:

exit

On the client

Set the DISPLAY environment variable locally:

export DISPLAY=:0.0

and start a trusted SSH connection to the server:

ssh -Y $ssh_user@$ssh_server

Verify success with a graphical app. Install an app supporting X11 forwarding, if needed. As an example:

yum -y install xclock

and action:

for i in {1..3} ; do bash -c "xclock &" ; done ;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...