Cygwin X11 forwarding using Xming - ssh

i am connected with cygwin to a ssh server
there i want to open a application via x11-forwarding
i use xming as x11 server on my windows machine
now in putty i had the possibility to automatically forward x11 and so i dont need to export my DISPLAY, thats not a problem i can set it every time i connect to the server.
but if i export my DISPLAY, it wont start the application it always says:
Error: Can't open display: xxx.xx.xx.xx
i really liked the way putty worked and want to user cygwin.
i tried Cygwin/X but there always opens another terminal which i dont really like. i like to open my application from my existing standart cygwin terminal where i also connect to the server
is there any way doing this?!

i startet the xserver with the following command and after that i could start the programms automatically on my remote ssh server and it was forwarded automatically to my xserver
startxwin -- -listen tcp &
after this i even didnt have to set the DISPLAY

Related

X11 forwarding: `xclock` works but not `cmake-gui`

I am connecting (ssh) to my host (Mac) from my client (Windows) machine. I have X11 forwarding active.
Now, running xclock on my host opens up the clock gui window on my client as expected, but running cmake-gui does not. I can see the application gui open up on my host (through teamviewer), but it isn't shown on my client.
I was able to make it work with WSL but somehow it's not working for my iMac as host.
I can provide more details if needed. Let me know how.

Remote access to a Jetson Nano

I am trying to remotely access a Jetson Nano from my mac. So far I have done the following:
I installed microsoft Remote Desktop on my mac
I connected the nano with my mac through the Micro-usb Port
In network I could see the connection "linux for Tegra" where my nano would be 192.168.55.1
With this I still cannot remote access the nano
So I open a terminal and typed
>ssh username#192.168.55.1
and I could access the nano terminal.
So I think now, I have to do
>sudo apt install xrdp
in order to be able to remotely access the GUI.
However, the nano does not have internet connection.
Is there a way that it can use the internet connection of my mac to do this?
(I am reading a tutorial on Rasppi with windows and apparently this is possible)
One of the approaches is to install X server for mac and then use ssh -Y username#192.168.55.1. You will get the command line shell first but you can type in commands like gedit - they windows will show up on the host.
192.168.55.1 is the same network as any other. All tools supposed to work over TCP/IP should work with it as well.
USB is a Serial connection by default.
On windows use a putty based tool.
For example start with MobaXterm > New session > Serial #11500
Login
Password
It won't forward internet by default.
Best simple way is to plug in your phone as USB network sharing and plug in to the laptop via micro-USB.
For Linux, Ubuntu, use a serial ("COM" related stuff) tool.
If you want to do ssh through USB it will require custom editing of networking file.
By default Nano is using a bridge called L4TBRO on 192.168.55.1, laptop is client in .100.
DNS server is on Nano's side.
You would have to create a new interface but using your laptop as DCHP and DNS servers.
Note that usb can power the Jetson Nano for continuous execution on a recent laptop. Some recommends not to and it may crash if you run a compilation on all cores. (if it crashes, just disable 2 cores via nvpmodel -m 1)

When using ssh -X to connect to remote Ubuntu 18.04, couldn't it show server's local terminal GUI on my own PC?

I found a strange thing when using ssh -X to connect to two servers.
Ubuntu16.04 is installed on one server, while Ubuntu 18.04 is installed on the other. I upload a simple shell script as following to both servers:
#!/bin/bash
tab=" --tab"
options=()
cmds[1]="echo Banana"
cmds[2]="echo Cat"
for i in 1 2; do
options+=($tab -e "bash -c '${cmds[i]} ; bash'" )
done
gnome-terminal "${options[#]}"
exit 0
You know this script will open a new terminal window on server with two tabs. One tab will print "Banana", and the other tab will print "Cat".
Then I using ssh -X to remotely login into the first server (Ubuntu 16.04) and execute this script on server, I got a new terminal opened with two tabs on my pc. That is I saw the remote terminal GUI of server on my own computer. However, if I repeated these steps on the second server(Ubuntu18.04), I will got nothing to show on my computer.
The I execute commandgedit on the ssh login terminal when using ssh -X to login into both servers, I could see the GUI on my computer for both the cases.
I guess Ubuntu 18.04 cannot transport terminal's GUI through ssh -X to my pc. I was very confused about this. Could you please to explain the reason? And BTW, how can I see terminal's GUI of server in this case? Thanks a lot!
ssh -X doesn't transport a terminal. It tunnels a X11 connection.
X11 in its core is a network based display protocol. The programs (X clients) connect to a X server (a program running on your local machine) and instruct it to create windows and draw stuff to it. There is no graphical rendition of any kind anywhere else than the X server!
ssh -X does not operate like Windows Remote Desktop, where there is an actual graphics environment running on the remote machine. Hence if you create two separate ssh -X connections (maybe even from different machines), these connections are completely independent from each other. Hence you cannot use ssh -X to connect with a preexisting X session!
What you want is either Xvnc or Xpra, where the graphics environment is actually run on the remote machine, and only the output is transferred to your local machine.

Remote access Jupyter notebook from Windows

I usually access Jupyter notebook running on Linux from Mac OS X via port forwarding like following:
https://coderwall.com/p/ohk6cg/remote-access-to-ipython-notebooks-via-ssh
Is it possible to do similar thing from Windows 10 instead of Mac OS? I guess putty or WSL offer one.
https://www.akadia.com/services/ssh_putty.html
https://superuser.com/questions/1119946/windows-subsystem-for-linux-ssh-port-forwarding
You can create an SSH tunnel to connect to the Jupyter Notebook or Jupyter Lab web interface using PUTTY on windows.
Download the latest version of PUTTY
Open PUTTY and enter the server URL or IP address as the hostname
Now, go to SSH on the bottom of the left pane to expand the menu and then click on Tunnels
Enter the port number which you want to use to access Jupyter on your local machine. Choose 8000 or greater (i.e. 8001, 8002, etc.) to avoid ports used by other services, and set the destination as localhost:8888 where :8888 is the number of the port that Jupyter Notebook is running on. Now click the Add button, and the ports should appear in the Forwarded ports list.
Click the Open button to connect to the server via SSH and tunnel to the desired ports.
In the PUTTY terminal, run Jupyter, where the default port is 8888
jupyter lab --no-browser or jupyter-notebook --no-browser
Copy the server path into the browser on your local system and navigate to the notebook
http://localhost:8888/lab?token=... or http://127.0.0.1:8888/lab?token=...
Note:
If running remotely to your employer, a VPN connection will probably be required.
As an addendum to this answer, this screenshot shows how putty config looks like:
On the Linux machine, I then start Jupyter with:
jupyter notebook --no-browser --port=8889
Finally, on the windows (or any remote machine) I enter localhost:8888 in the browser.
It asks for the token, that is provided at the shell of the Linux machine.
--
Note which port refers to which machine, I have the notebook on port 8889, the browser calls it at localhost:8888
I solved this problem by myself. My solution is using Windows Subsystem for Linux (WSL). This offers (virtual?) Linux console like Ubuntu. I just use ssh with -L option on it.
Follow the steps below.
step1- Download putty.
step2- Insert ip address or hostname.
step3- Go to SSH and expand.
step4- Add address of jupyter-notebook to destination column ex: localhost:6666. Add local port such as 8000 to source and press add button. Then connect, it should work.
I wanted to use the VPN Server feature of my cable box to enable remoting into my network, especially to run jupyter notebook. For my situation, probably not quite the same as anyone elses, this works fine.
On the cable box, be sure to enable the VPN Server and enable external access.
On the remote Windows 10 computer, add a PPTP VPN specifying cable box's external IP. Connect to the VPN. Verify you can access the network. e.g. You should be able to see the cable box's webpage.
On the Jupyter serving computer, in Windows Defender Firewall, you need to create a new Inbound Rule for a Port.
3.1. General-> Enabled, Allow the connection
3.2. Protocols and Ports-> TCP, 8888
3.3. Scope-> Private
On the Jupyter serving computer, invoke Jupyter (e.g 192.168.0.1, port 8888):
jupyter-notebook --ip 192.168.0.1 --port 8888 --no-browser
On the remote computer, you should now be able to access your Jupyter server by browsing to http://192.168.0.8:8888/tree

Access an xterm window open on local machine , remotely via ssh

I have an xterm window open on a computer. I want to access this xterm window remotely using ssh. Is it possible? By access I mean, I should be able to run commands on that open shell.
I'm not sure if it is possible to access an xterm window that's already been opened, while being over ssh. However, you can certainly open an ssh connection with X11 forwarding capabilities. Once X11 is forwarded, you can just run the program in ssh's command line, and it'll open in your forwarded X11 screen.
Here's a good article that explains in detail what you need to accomplish this: http://www.math.umn.edu/systems_guide/putty_xwin32.html
For example, after completing the details in the above article, and assuming you have Gnome Desktop installed, you could run gnome-terminal over ssh and have a Unix terminal open and forwarded over the ssh connection. Pretty much any application that has a GUI is runnable this way.