[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: X11 Forwarding


Hi Wesley

I don't think that libssh implements passing the data stream of an
X11-type channel to X11. The ssh_channel_accept_x11() call is simply
forwarded to ssh_channel_accept() with X11 as channel type flag. I guess
you have to read from the channel with ssh_channel_read() and pass the
stream to X11 yourself.

Regards
Tilo

Am 11.02.2017 um 18:27 schrieb Wesley Witt:
> I am trying to get X11 forwarding working and it appears that the right support is in libssh, but the docs are not clear as to how to make it work.
> 
> Below is the code and the resulting libssh log. Xclock does execute but I do not see the UI display on the remote computer. There is a note in the docs about seeting the DISPLAY variable, but I'm not sure where to set it. I tried using ssh_channel_request_env but that does not work. I'm not even sure if this is the issue. Any help would be appreciated.
> 
> If I start an SSH session using "ssh -X", set the DISPLAY variable in the shell and then start xclock it works as expected. This is what I want to accomplish with libssh.
> 
> 
> m_channel = ssh_channel_new(m_session);
> ssh_channel_open_session(m_channel);
> ssh_channel_request_x11(m_channel, 1, NULL, NULL, 0);
> ssh_channel_request_exec(m_channel, "xclock");
> ssh_channel x11_channel = ssh_channel_accept_x11(m_channel, 3000);
> 
> 
> [2017/02/11 09:23:47.520517, 2] ssh_connect:  libssh 0.7.2 (c) 2003-2014 Aris Adamantiadis, Andreas Schneider, and libssh contributors. Distributed under the LGPL, please refer to COPYING file for information about your rights, using threading threads_noop
> [2017/02/11 09:23:47.528022, 2] ssh_socket_connect:  Nonblocking connection socket: 472
> [2017/02/11 09:23:47.528022, 2] ssh_connect:  Socket connecting, now waiting for the callbacks to work
> [2017/02/11 09:23:47.528522, 1] socket_callback_connected:  Socket connection callback: 1 (0)
> [2017/02/11 09:23:47.535528, 1] ssh_client_connection_callback:  SSH server banner: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
> [2017/02/11 09:23:47.535528, 1] ssh_analyze_banner:  Analyzing banner: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
> [2017/02/11 09:23:47.535528, 1] ssh_analyze_banner:  We are talking to an OpenSSH client version: 7.2 (70200)
> [2017/02/11 09:23:47.638095, 2] ssh_packet_dh_reply:  Received SSH_KEXDH_REPLY
> [2017/02/11 09:23:47.641598, 2] ssh_client_curve25519_reply:  SSH_MSG_NEWKEYS sent
> [2017/02/11 09:23:47.641598, 2] ssh_packet_newkeys:  Received SSH_MSG_NEWKEYS
> [2017/02/11 09:23:47.643599, 2] ssh_packet_newkeys:  Signature verified and valid
> [2017/02/11 09:23:47.691131, 2] channel_open:  Creating a channel 43 with 64000 window and 32768 max packet
> [2017/02/11 09:23:47.788195, 2] ssh_packet_global_request:  Received SSH_MSG_GLOBAL_REQUEST packet
> [2017/02/11 09:23:47.788696, 2] ssh_packet_global_request:  UNKNOWN SSH_MSG_GLOBAL_REQUEST hostkeys-00@xxxxxxxxxxx 0
> [2017/02/11 09:23:47.788696, 1] ssh_packet_process:  Couldn't do anything with packet type 80
> [2017/02/11 09:23:47.788696, 2] ssh_packet_channel_open_conf:  Received a CHANNEL_OPEN_CONFIRMATION for channel 43:0
> [2017/02/11 09:23:47.788696, 2] ssh_packet_channel_open_conf:  Remote window : 0, maxpacket : 32768
> [2017/02/11 09:23:47.789196, 2] channel_request:  Channel request x11-req success
> [2017/02/11 09:23:47.789696, 2] channel_rcv_change_window:  Adding 2097152 bytes to channel (43:0) (from 0 bytes)
> [2017/02/11 09:23:47.789696, 2] channel_request:  Channel request exec success
> 
> 


References:
X11 ForwardingWesley Witt <wesw@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org