Could be a flaming thread but hope you dont mind a question from a curious Joe here.
I have Desktop computer running downstairs running with winxp pro,cygwin,sshd,xwin.
Whilst that, I am working upstair with my laptop and my wife will be using the desktop downstair(watching movie,etc,etc). My laptop upstairs is already loaded with Mobaxterm (which actually translate to cygwin as well).
I have already configure my desktop properly with user and ssh and xwin. When I use my laptop to ssh into desktop downstairs, starting the xclock, all works fine. I can see the xclock on my laptop.
Here is my question:
Is it possible now to run firefox(C:\Program Files\Mozilla\Firefox.exe) on my desktop via ssh and getting the display to laptop, so I could control the desktop downloading from upstairs.
After I ssh to my desktop downstair and when I try
cd \cygdrive\c\Program/ Files\Mozilla
./Firefox
Nothing came through display on my laptop.
Any advice. I know vnc could work but meaning to say it would interupt my wife work periodically where she is using on the desktop downstair. And, I have already intended to buy another nettop to do this.
Is there any solutions to this for the time being?
Thanks.
This won't work the way you are describing it. You are using SSH + Xwindows to remotely display unix programs like xclock, not native Windows apps like firefox. You need to see if you can get Firefox compiled for cygwin on X. I have no idea if it is even possible, you may want to search with keywords "firefox xwindows cygwin".
You may be able to do something with Remote Desktop, I'm not sure if it would interrupt your wife's work though. There's a write-up with using it over ssh here.
Related
dear Craig McQueen!
I am referring to: Remote debug of Rust program in Visual Studio Code
My config is slightly different that is why I cannot get everything going here:
VScode installed on WIN32 with RUST components successfully!
remote system: odroid C2 ARM64 with UBUNTU18.04 with Kernel 5.14nwith IP: 192.xxx.6.x - user odroid.
I need to remote-compile a Rust program called: c2_mmap_gpio on the OdroidC2
This is already a project on the WIN32.
I did all the steps but it doesn't work.
I think it is not possible to try to run a remote_debug.sh (bash) on a windows machine, right? If yes workaround on this?
I think I need to input my user PWD somewhere to be able to ssh into the remote linux machine, right?
Correct, the remote_debug.sh I described in my answer is good only for a Linux system, and not suitable for a Windows system. For a Windows development system, you would need to write a Windows batch file or Powershell script that provides the equivalent functionality to that remote_debug.sh Bash script.
I'm not proficient in Powershell scripts, and I'm happy using Linux
as my host development machine, so I don't have plans to write such a script.
Regarding needing to enter a password for the SSH operations... Good point. That's something I didn't think to mention in my answer. You need to remove the need for a password to be entered, in one of two ways:
Install your public SSH credentials onto the target, using ssh-copy-id (or the Windows equivalent). Then you should be able to SSH to the target without needing to enter your password.
Give a blank password to the target user on the target, using passwd -d <username>. Note this reduces security, so this is not recommended, especially if the target is accessible via the public Internet.
Is it possible to use $ code . in remote server ssh session just like I do in WSL when I want to open current working directory in remote host in local VSCode?
ADDENDUM:
In local WSL, I can issue $ code . and that would open the current directory in VSCode which is installed on Windows 10.
I am trying to get the same behavior in another remote Linux which I have connected to remotely through ssh. So when I am on that remote machine and issue $ code . it would open that directory in VSCode installed on local window.
I don't imagine this would be simple to do but I certainly share your desire to want to be able to do it.
Problem
Here's an explanation of why it doesn't work, and a hint at why it's probably quite a difficult thing to setup:
The way code . works from WSL (or PowerShell) is by launching VS Code in the given directory (passed as the first argument as the dot).
When you run code from WSL it uses wslpath to convert the path to the Windows accessible one, and the WSL magic executes code.exe (which is, after all, a Windows binary and not a Linux one) in Windows with the WSL path (\\wsl$...);
Theory
In order for this to work you need to achieve three things:
Work out which remote you're connected to, and be able to pass that information to vscode
Execute code.exe on your local machine, but from your remote terminal
Ideas
A couple of ideas you could play with if you wanted to try and implement it:
A script on your remote could output a vscode:// URL for you to click (or find a way to get your client to auto-load it).
You might be able to use a forwarded port in your SSH session to contact something on your PC (perhaps custom made, or maybe with Windows RDP or a telnet/ssh server perhaps?)
Perhaps mount a local directory as part of your SSH connection (I don't know all the edges of SSH but it does a lot of cool stuff! SCP might help?) and be able to execute/trigger things?
Just some musings! It's not something I need enough to put any effort into it, but I came across your question looking for something else and found it interesting. Hope that's helpful to anybody, any thoughts/feedback is welcome!
So I've already solved this problem, but it was so frustrating I wanted to make sure there was a post about it for people in the future.
The issue comes from Chrome OS's browser, because it does not support links that open apps in linux, such as vscode://. On linux systems, such as the ubuntu container used to install linux apps on Chrome OS, opening links is handled by xdg-open, which starts the browser/associated programs.
On Chrome OS however, this doesn't happen. Because it is not linux, and does not rely on the linux filesystem, the normal system for registering alternate URL protocol handlers does not function. This means that vscode:// and other such links don't work.
Solution
This is more of a workaround than a permanent solution, but will work:
xdg-open <url>
Usage
It may not be immediately clear on exactly how to use xdg-open with your links, or even how to get links. I found this problem when logging into VSCode live share using microsoft. What you have to do is quite simple:
Inspect the page
Go to Network or equivalent
Click Continue
Right click the new request sent
Copy address
Open up terminal
Write xdg open
Paste your link, making sure to put "" quotation marks around it, because they often contain the & character, which is significant in bash.
Enjoy
Explanation
It was a problem not well documented, because few people try to run VSCode on Chrome OS. The root of the problem, as I said, comes from the browser not being linked to anything else.
The heart of protocol handlers rests in this directory:
~
❯ ls ~/.local/share/applications/
mimeinfo.cache vsls-launcher.desktop
vsls-launcher.desktop contains the data necessary for xdg-open to launch vscode with vscode:// links.
My first hints came from this reddit thread, u/kgjv's comment in particular: https://www.reddit.com/r/Crostini/comments/chizyk/crostini_how_to_make_linux_apps_open_links_in/
It says how xdg-open will launch chrome from linux, so I did a little more digging and found ~/.local/share/applications/ to contain the configuration.
Any apps that support this will have their own .desktops, so you need only copy the link and launch it with xdg open
I tried the method with simplenote on Lenovo Duet, but it did not work, it just kept on saying no URL handler. It might have been due to it being only available as an app image for arm64 architecture.
Anyways I solved it by installing another browser on Linux, Example:
sudo apt install firefox-esr
Browsers installed by this method are then made the default browser for links opened from linux, and also easily picks up the url-schemes since it also runs from the same partition.
Note: This is just a workaround as installing another browser kinda goes against the entire chome-os ideals but it always comes in handy while dealing with Linux apps.
I have this problem going on for few days, every time I open my laptop it starts Windows Powershell automatically.It's not causing me any problem as I close it once it opens, but I am quite annoyed by it and wants to know if this is some problem or just something went bad with my settings. I am using windows 10 pro.
There is probably an autorun entry for Powershell registered on your system. Without more information, it's not possible to tell how it got there.
Programs registering themselves to start up on boot is a common symptom of malware infection, but most malware would also try to hide any visual cues, i.e. the Powershell window would be hidden.
To troubleshoot further, you can try the free utility Autoruns available from Microsoft. Look for any entries related to Powershell.
I use Emacs remotely using X-Server in a Windows client and Linux server. I noticed that I can halt it using ctrl-z and then type fg 1 to get it working again. Is there some way that I could get it to halt on the machine that I am on, and then log into a different machine and start where I left off? When I start a new ssh session, the emacs job isn't associated to my terminal. There must be someway to "steal" it.
Also, maybe there's an Emacs feature that will do basically the same thing. However, I think closing and re-opening all my files and buffers would take quite a while.
Expanding on the idea of using emacsclient, you can look at what what someone did to solve the problem of editing a file from a different machine than where (s)he started running Emacs.
As of Emacs 23, you can run emacsclient in terminal windows using the -nw option.
Other solutions you might want to try are to use:
gnu screen
vnc
For years I used screen to "attach" and "detach" from a virtual terminal that sounds like your usage model. If you have the ability to use graphics... vnc is really great, just do your work in a vnc session and connect to it any machine.
And your last idea is already implemented by the package desktop (which is bundled with Emacs). Take a look at the wiki page for session management, which includes other alternatives to desktop, as well as add-ons for desktop to lazily load files.
You can run emacs as a server, and use emacsclient to connect to it. You can open multiple connections to the same emacs server, via ttys or X11.
When doing this, C-X C-C will close your connection, and leave the server running.
A simple way to do this by invoking emacs as follows. This will connect to the server if one is running, or create one.
emacsclient --alternate-editor="" -c
Sometimes I will be at work and have to run out the door leaving my Emacs session as it was. Later, I will open an Emacs instance to the same machine (usually using remote SSH) and find that I have files open in Emacs. Now the good news. Emacs allows you to "steal" those files using M-x recover-this-file. I recommend one of Trey's solutions if you can plan ahead. If not, you can use this recover file technique to keep progress moving.