Code Monkey home page Code Monkey logo

Comments (7)

totaam avatar totaam commented on September 27, 2024

I thought it would be easier to try than to ask!
Yes, when xpra execs ssh, ssh will do whatever it normally does.
Run xpra with Xpra_cmd.exe -d ssh attach ssh://user@host/ to see more details.

from xpra.

cadem avatar cadem commented on September 27, 2024

If I don't specify --ssh=ssh, I can connect successfully. But when I add --ssh=ssh, connection will failed.

"c:\Program Files\Xpra\Xpra_cmd.exe" -d ssh --ssh=ssh attach ssh://[email protected]:40221/100

2024-05-03 22:21:29,452 Xpra GTK3 client version 6.0-r0
2024-05-03 22:21:29,763  running on Microsoft Windows Microsoft Windows Server 2022 Standard
2024-05-03 22:21:29,763  cpython 3.11
2024-05-03 22:21:32,214 GStreamer version 1.24.2
2024-05-03 22:21:32,231 created named pipe 'Xpra\9412'
2024-05-03 22:21:32,560 keyboard layout 'Chinese (Simplified) - US Keyboard' : 'cn' (0x804)
2024-05-03 22:21:32,659 debug enabled for ['xpra.net.ssh.exec_client', 'network', 'ssh']
2024-05-03 22:21:32,665 executing ssh command: ssh -l ubuntu -p 40221 -T 127.0.0.1 'sh -c '"'"'if command -v "xpra" > /dev/null 2>&1; then xpra _proxy "100";elif [ -x $XDG_RUNTIME_DIR/xpra/run-xpra ]; then $XDG_RUNTIME_DIR/xpra/run-xpra _proxy "100";elif [ -x /usr/local/bin/xpra ]; then /usr/local/bin/xpra _proxy "100";elif [ -x ~/.xpra/run-xpra ]; then ~/.xpra/run-xpra _proxy "100";elif [ -x Xpra_cmd.exe ]; then Xpra_cmd.exe _proxy "100";else echo "no run-xpra command found"; exit 1; fi'"'"''
2024-05-03 22:21:32,676  keyboard settings: layout=cn
2024-05-03 22:21:32,676  desktop size is 1600x1200:
2024-05-03 22:21:32,676   Default (423x317 mm - DPI: 96x96) workarea: 1600x1160
2024-05-03 22:21:32,676     通用非即插即用监视器       (423x318 mm)
2024-05-03 22:21:32,922 SSH EOF on stderr of ['ssh', '-l', 'ubuntu', '-p', '40221', '-T', '127.0.0.1', 'sh -c \'if command -v "xpra" > /dev/null 2>&1; then xpra _proxy "100";elif [ -x $XDG_RUNTIME_DIR/xpra/run-xpra ]; then $XDG_RUNTIME_DIR/xpra/run-xpra _proxy "100";elif [ -x /usr/local/bin/xpra ]; then /usr/local/bin/xpra _proxy "100";elif [ -x ~/.xpra/run-xpra ]; then ~/.xpra/run-xpra _proxy "100";elif [ -x Xpra_cmd.exe ]; then Xpra_cmd.exe _proxy "100";else echo "no run-xpra command found"; exit 1; fi\'']
2024-05-03 22:21:32,922 remote SSH stderr:
2024-05-03 22:21:32,922 Error: failed to receive anything, not an xpra server?
2024-05-03 22:21:32,922  Host key verification failed.
2024-05-03 22:21:32,922   could also be the wrong protocol, username, password or port
2024-05-03 22:21:32,922   or the session was not found
2024-05-03 22:21:32,922 Connection failed

from xpra.

totaam avatar totaam commented on September 27, 2024

Is your ssh server on port 40221? Or is it an xpra server that is forwarded to this port?
The xpra client runs:

ssh -l ubuntu -p 40221 -T 127.0.0.1 'sh -c '"'"'if command -v "xpra" > /dev/null 2>&1; then... '"'"''

The quotes look wrong to me. Perhaps it comes from here:

if nssh >= 2 and MAGIC_QUOTES:
for _ in range(nssh):
remote_cmd = shlex.quote(remote_cmd)

In which case running with xpra_cmd.exe --env=XPRA_SSH_MAGIC_QUOTES=0 ... might help.

from xpra.

cadem avatar cadem commented on September 27, 2024

I forward remote ssh(22) to local(40221).

I run the following command and paste result.

  1. "c:\Program Files\Xpra\Xpra_cmd.exe" -d ssh attach ssh://[email protected]:40221/100
    show remote app sucessfully.

2."c:\Program Files\Xpra\Xpra_cmd.exe" -d ssh --ssh=ssh attach ssh://[email protected]:40221/100

2024-05-05 15:29:11,897 Xpra GTK3 client version 6.0-r0
2024-05-05 15:29:12,230  running on Microsoft Windows Microsoft Windows Server 2022 Standard
2024-05-05 15:29:12,230  cpython 3.11
2024-05-05 15:29:14,638 GStreamer version 1.24.2
2024-05-05 15:29:14,647 created named pipe 'Xpra\8856'
2024-05-05 15:29:14,960 keyboard layout 'Chinese (Simplified) - US Keyboard' : 'cn' (0x804)
2024-05-05 15:29:15,053 debug enabled for ['xpra.net.ssh.exec_client', 'network', 'ssh']
2024-05-05 15:29:15,069 executing ssh command: ssh -l ubuntu -p 40221 -T 127.0.0.1 'sh -c '"'"'if command -v "xpra" > /dev/null 2>&1; then xpra _proxy "100";elif [ -x $XDG_RUNTIME_DIR/xpra/run-xpra ]; then $XDG_RUNTIME_DIR/xpra/run-xpra _proxy "100";elif [ -x /usr/local/bin/xpra ]; then /usr/local/bin/xpra _proxy "100";elif [ -x ~/.xpra/run-xpra ]; then ~/.xpra/run-xpra _proxy "100";elif [ -x Xpra_cmd.exe ]; then Xpra_cmd.exe _proxy "100";else echo "no run-xpra command found"; exit 1; fi'"'"''
2024-05-05 15:29:15,085  keyboard settings: layout=cn
2024-05-05 15:29:15,093  desktop size is 1600x1200:
2024-05-05 15:29:15,093   Default (423x317 mm - DPI: 96x96) workarea: 1600x1160
2024-05-05 15:29:15,093     通用非即插即用监视器       (423x318 mm)
2024-05-05 15:29:15,337 SSH EOF on stderr of ['ssh', '-l', 'ubuntu', '-p', '40221', '-T', '127.0.0.1', 'sh -c \'if command -v "xpra" > /dev/null 2>&1; then xpra _proxy "100";elif [ -x $XDG_RUNTIME_DIR/xpra/run-xpra ]; then $XDG_RUNTIME_DIR/xpra/run-xpra _proxy "100";elif [ -x /usr/local/bin/xpra ]; then /usr/local/bin/xpra _proxy "100";elif [ -x ~/.xpra/run-xpra ]; then ~/.xpra/run-xpra _proxy "100";elif [ -x Xpra_cmd.exe ]; then Xpra_cmd.exe _proxy "100";else echo "no run-xpra command found"; exit 1; fi\'']
2024-05-05 15:29:15,337 remote SSH stderr:
2024-05-05 15:29:15,337  Host key verification failed.
2024-05-05 15:29:15,337 Error: failed to receive anything, not an xpra server?
2024-05-05 15:29:15,337   could also be the wrong protocol, username, password or port
2024-05-05 15:29:15,337   or the session was not found
2024-05-05 15:29:15,337 Connection failed

3.ssh -l ubuntu -p 40221 -T 127.0.0.1 'sh -c '"'"'if command -v "xpra" > /dev/null 2>&1; then xpra _proxy "100";elif [ -x $XDG_RUNTIME_DIR/xpra/run-xpra ]; then $XDG_RUNTIME_DIR/xpra/run-xpra _proxy "100";elif [ -x /usr/local/bin/xpra ]; then /usr/local/bin/xpra _proxy "100";elif [ -x ~/.xpra/run-xpra ]; then ~/.xpra/run-xpra _proxy "100";elif [ -x Xpra_cmd.exe ]; then Xpra_cmd.exe _proxy "100";else echo "no run-xpra command found"; exit 1; fi'"'"''
The system cannot find the path specified.

4. "c:\Program Files\Xpra\Xpra_cmd.exe" -d ssh --ssh=ssh --env=XPRA_SSH_MAGIC_QUOTES=0 attach ssh://[email protected]:40221/100

2024-05-05 15:32:51,715 Xpra GTK3 client version 6.0-r0
2024-05-05 15:32:52,020  running on Microsoft Windows Microsoft Windows Server 2022 Standard
2024-05-05 15:32:52,030  cpython 3.11
2024-05-05 15:32:54,365 GStreamer version 1.24.2
2024-05-05 15:32:54,371 created named pipe 'Xpra\10572'
2024-05-05 15:32:54,684 keyboard layout 'Chinese (Simplified) - US Keyboard' : 'cn' (0x804)
2024-05-05 15:32:54,784 debug enabled for ['xpra.net.ssh.exec_client', 'network', 'ssh']
2024-05-05 15:32:54,784 executing ssh command: ssh -l ubuntu -p 40221 -T 127.0.0.1 'sh -c '"'"'if command -v "xpra" > /dev/null 2>&1; then xpra _proxy "100";elif [ -x $XDG_RUNTIME_DIR/xpra/run-xpra ]; then $XDG_RUNTIME_DIR/xpra/run-xpra _proxy "100";elif [ -x /usr/local/bin/xpra ]; then /usr/local/bin/xpra _proxy "100";elif [ -x ~/.xpra/run-xpra ]; then ~/.xpra/run-xpra _proxy "100";elif [ -x Xpra_cmd.exe ]; then Xpra_cmd.exe _proxy "100";else echo "no run-xpra command found"; exit 1; fi'"'"''
2024-05-05 15:32:54,801  keyboard settings: layout=cn
2024-05-05 15:32:54,817  desktop size is 1600x1200:
2024-05-05 15:32:54,817   Default (423x317 mm - DPI: 96x96) workarea: 1600x1160
2024-05-05 15:32:54,817     通用非即插即用监视器       (423x318 mm)
2024-05-05 15:32:55,052 SSH EOF on stderr of ['ssh', '-l', 'ubuntu', '-p', '40221', '-T', '127.0.0.1', 'sh -c \'if command -v "xpra" > /dev/null 2>&1; then xpra _proxy "100";elif [ -x $XDG_RUNTIME_DIR/xpra/run-xpra ]; then $XDG_RUNTIME_DIR/xpra/run-xpra _proxy "100";elif [ -x /usr/local/bin/xpra ]; then /usr/local/bin/xpra _proxy "100";elif [ -x ~/.xpra/run-xpra ]; then ~/.xpra/run-xpra _proxy "100";elif [ -x Xpra_cmd.exe ]; then Xpra_cmd.exe _proxy "100";else echo "no run-xpra command found"; exit 1; fi\'']
2024-05-05 15:32:55,052 remote SSH stderr:
2024-05-05 15:32:55,052 Error: failed to receive anything, not an xpra server?
2024-05-05 15:32:55,052  Host key verification failed.
2024-05-05 15:32:55,052   could also be the wrong protocol, username, password or port
2024-05-05 15:32:55,052   or the session was not found
2024-05-05 15:32:55,052 Connection failed

from xpra.

totaam avatar totaam commented on September 27, 2024

@cadem as per #4207 (comment), have you tried running with magic quotes off?

Silly question: how is ssh installed on MS Windows?
Using ssh=ssh is not a supported configuration on MS Windows, ssh=plink is, and only for non-light builds.

from xpra.

cadem avatar cadem commented on September 27, 2024
  1. I had openssh installed on my windows,
    C:\Users\Administrator>ssh -V
    OpenSSH_for_Windows_9.4p1, LibreSSL 3.7.3

  2. I plink, it works, but plink doesn't support alias name in .ssh/config file.

from xpra.

totaam avatar totaam commented on September 27, 2024

So, I gave it a go and it is definitely possible, but tricky.
There seems to be some conflict between the system parsing xpra's command, then xpra parsing the ssh option within that, then the windows shell parsing the command again when we execute ssh..

FWIW, with 6.1-r35740, I can connect via ssh using openssh:

./Xpra_cmd.exe attach ssh://192.168.0.10:10000/ \
    -d ssh --ssh="ssh -v -o UserKnownHostsFile='C:\msys64\home\Windows\ 10\ Test\.ssh\known_hosts'"

But beware that anything which requires user interaction (password or key passphrase, etc) will fail and show this in the output with ssh -v:

 debug1: read_passphrase: can't open /dev/tty: No such device or address

That's because the stdin, stdout and stderr pipes are attached to the parent xpra process so that it can use them to communicate with the remote proxy.

And I have no idea how to tell ssh to use either our own tool for the prompts (what SSH_ASKPASS is meant to do) or how to make it use another tty.. (ie: tty outputs /dev/pty0 on my system).

Some links:

from xpra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.