Using web browser and putty for developing web-server on WSL - webserver

Can I use putty and web-browser for testing my web-server code in Linux ?
I'm using WSL with Ubuntu18.04 , it's very convenient to use it because I'm using vs code as IDE ...
So to test my code i need a putty (as a client) and the web-browser to run my code on ...

You can run tests on localhost. I think WSL shares the same IP address.

We can use web-browser with loaclhost for testing webserver on wsl .
We can test it by running on wsl this: "python3 -m http.server 8000"

Related

Disable install of VS Code server

I use my VS Code remote - SSH extension to jump between a lot my customers servers, and would actually like not install the VS Code server on every server that I use.
Is there a way not to install the VS Code server, when you use the Remote - SSH extension, or is there maybe even another extension I should use instead?
To fix this on your own (without using the script mentioned above), you could simply log into each of the linux. cs servers (using SSH), then the command pkill -u node , which will stop any running vscode-server processes
I fixed it but not using the official remote - SSH, but the extension SSH FS, which is a little more combersome as it can see you'r "normal" ssh config, but i works.
https://marketplace.visualstudio.com/items?itemName=Kelvin.vscode-sshfs

is vscode remote-ssh inception possible?

I am connecting remote linux and developing some application. To run the application I need to connect to another host for debugging due to resource availibility using srun command.
Seems like partial inception is possible using below in launch.json.
"miDebuggerServerAddress": "remoteHostname:9091",
And running the command on remote host as:
user#remoteHostname $ gdbserver :9091 ./myapplication arguments to my program

Remote editing over ssh to windows server

Remote SSH plugin states VS Code Insiders has experimental support for Windows 10/Server 1803+ using the official OpenSSH server.
I have the official OpenSSH server installed and configured on Windows Server 2019 1809. I can connect via pubkey authentication and have PowerShell Core over ssh working as well. I tried both Remote SSH and Remote SSH nightly plugin. At first it was complaining that it couldn't find bash. So I installed git bash and added it to the system path. I get the following error when attempting to connect to my windows server:
[16:02:41.398] Log Level: 3
[16:02:41.399] remote-ssh-nightly#2019.12.24000
[16:02:41.399] darwin x64
[16:02:41.401] SSH Resolver called for "ssh-remote+myserver", attempt 1
[16:02:41.401] SSH Resolver called for host: myserver
[16:02:41.401] Setting up SSH remote "myserver"
[16:02:41.413] Using commit id "e74405d11443c5361c31e2bc341866d146eee206" and quality "insider" for server
[16:02:41.414] Testing ssh with ssh -V
[16:02:41.425] ssh exited with code: 0
[16:02:41.425] Got stderr from ssh: OpenSSH_7.9p1, LibreSSL 2.7.3
[16:02:41.430] Running script with connection command: ssh -T -D 51951 -o ConnectTimeout=15 myserver bash
[16:02:41.430] Install and start server if needed
[16:02:43.451] > 5122b1a5b835: running
> Unsupported architecture: MINGW64_NT-10.0-17763 x86_64
> 5122b1a5b835##27##
[16:02:43.452] Got some output, clearing connection timeout
[16:02:43.710] "install" terminal command done
[16:02:43.710] Install terminal quit with output: 5122b1a5b835##27##
[16:02:43.710] Received install output: 5122b1a5b835##27##
[16:02:43.710] Unsupported architecture
[16:02:43.711] Resolver error: The remote host's architecture is not supported
[16:02:43.714] ------
Anybody know the magic sauce to get Remote SSH working w/ Windows 10/Server?
Looks like VSCode is attempting to run bash on the server which I'm guessing would resolve to git's bash which is mingw based as I recall. VSCode should be running Powershell on the server.
Did you include your server in the list of windows remotes in the extension's settings?
Requires "remote.SSH.windowsRemotes" setting. Here is the documentation.
"remote.SSH.windowsRemotes": ["myserver"]

Use Jupyter Notebook on my local computer to run code on a remote computer

I use Jupyter Notebook to run bioinformatic analyses, and I love it. However, it only really plays nice when I run it on my personal computer. However, I regularly do analysis using a remote computer with multiple cores to reduce processing time. I'd like to be able to use the Jupyter Notebook interface on my personal computer while everything is actually running on the remote computer. I generally do this via ssh access to the remote computer within the shell and execute all commands at the command line. I'd love to do this from the Jupyter notebook on my personal computer, rather than from the shell on my personal computer. It is relevant that I don't have sudo access on the remote computer.
So far, I've installed miniconda and jupyter notebook on the remote computer like this:
wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
Once conda is installed properly, I install jupyter notebook via miniconda with this line:
conda install jupyter
This installs successfully. I can then start a jupyter notebook session on the remote machine with the line:
jupyter notebook --no-browser
So far, so good. My next question: How do I have my local jupyter notebook connect to the remote machine, so that I can execute commands on the remote machine using my local jupyter notebook? There is some documentation here, however i have been trying different things for hours, but have failed to succeed.
Can anyone give a straight forward method to connect to my remote server, given that I am this far along? I feel like it should just be a matter of entering url addresses and passwords into my local Jupyter notebook (all of this is so easy via ssh in the shell).
Follow the steps below:
Enable port forwarding on remote machine
ssh -N -f -L 127.0.0.1:8898:127.0.0.1:8898 user#remote-machine.com
Do ssh to your remote machine and then run following command on remote machine
jupyter-notebook --no-browser --port=8898
you will see some thing as shown below
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8898/token=eaf2f51f9c053f43d8bd093e76f0cc6301b545549c998fa2&token=eaf2f51f9c053f43d8bd093e76f0cc6301b545549c998fa2
Copy and paste the URL in your local machine browser.
If you want to access Jupyter/Ipython notebook running on a VPS remotely, I wrote a tutorial on the digital ocean community site.
As shown in the guide, after installing and running Ipython Notebook using command line on the server, you can connect to the notebook using SSH tunnelling with Putty (on windows) or the ssh -L command on Unix-like systems (ie Mac and Linux)

Running a GTK+ application on a Linux machine, from Windows

I have Installed GTK on a Linux machine.
I am connecting To Linux Machine from a Telnet Session to compile the GTK programs
From A Windows Machine. I am using Cygwin on Windows Machine. but i am not able to see
GUI output of my GTK program on my Windows Machine.
When i run program from my terminal i get this error:
(helloworld:22576): Gtk-WARNING **: cannot open display:
I tried solutions from every answer posted, but no use now i am getting following error:
$ ./helloworld
Invalid MIT-MAGIC-COOKIE-1 key
(helloworld:22710): Gtk-WARNING **: cannot open display: 172.25.0.161:0
and i am getting following error on my Cygwin console:
client 6 rejected from IP 172.25.0.91 Auth name: MIT-MAGIC-COOKIE-1 ID: -1
You must set the DISPLAY variable in your telnet session to the IP address or DNS name of your Windows machine and append ":0"
export DISPLAY=windows.your.domain:0
And you must start an X server on the Windows machine (comes with Cygwin but you must start it).
You need to run the X window system (install with Cygwin) on your Windows-box and enable remote connections (probably with xhost). Set the DISPLAY-variable on your Linux-box to the address of your Windows-box and :0, as such:
export DISPLAY=192.168.1.123:0
I can recommend using ssh rather than telnet, for security reasons. In this case you do not need to enable remote connections with xhost, and you do not need to set the DISPLAY-variable. You only need to enable X forwarding.
You should install X-server on your windows machine and make sure you have DISPLAY set to yourmachine:0 or something like that. Or better yet use ssh instead of telnet (e.g. putty) and tunnel your X connection. You'll have to do a bit on your own research, though, because the complete answer would be a lengthy one.
Install an small X server on Windows XMing32, then run it, use putty as a console client, and check "X11 Forwarding" in Connection->SSH->X11.
Unfortunately, X11 Forwarding is not available through Telnet, you must run a SSH server on the target Linux and connect through SSH. (See if /etc/ssh/sshd_conf requires enabling X11 Forwarding too).