I am setting up hotkeys currently with AutoHotKey, inside I run the line "Run "C:/Windows/System32/wsl.exe ssh host#ip"
What this does it load that file and pass it that command as if you were to load it in CMD and run "<program path> <command>"
The issue starts here. If I have WSL open, my keychain is loaded and I can ssh to the IP, however running it from a CMD (or in this case AHK loading the file with the command) it throws a publickey denied error as "technically" its not ACTUALLY inside WSL yet.
I haven't found a workaround/anything that could make this work
I am expecting this to open up wsl and THEN run the ssh command, not try to do it all straight away because then the keychain isn't loaded
TL;DR
Trying to open wsl with via "C:/Windows/System32/wsl.exe ssh USER#HOST" being run in CMD/Batch File, this gives publickey denied as its not technically loaded up the keychain in WSL yet
Related
I am able to ssh on my windows 10 computer using ubuntu subsystem when I run the command:
/mnt/c/Users/marti/Downloads$ sudo ssh -i credfile.pem ec2-user#3.333.33.333
Where I have a file located at /mnt/c/Users/marti/Downloads/credfile.pem
I am trying to get VSCode's ssh extension to work but it keeps failing with an error "The process tried to write to a nonexistent pipe"
In my vscode settings it points to my ssh config file:
In order to connect I click the green bottom left corner of my vscode window and select the first option 'remote-ssh connect current window to host'
I paste in my command, hit enter, it prompts me to choose either mac/win/linux and I pick linux.
But it then just leads to an error saying it tried to write to a nonexistent pipe?
[20:50:27.876] "install" terminal command done
[20:50:27.877] Install terminal quit with output: The process tried to write to a nonexistent pipe.
[20:50:27.877] Received install output: The process tried to write to a nonexistent pipe.
[20:50:27.883] Resolver error: Error: The process tried to write to a nonexistent pipe
Is there something else I need to setup or change for my vscode ssh connection to work?
Instead of pasting your command, you should code the same command in your .ssh/config file.
Add in it:
Host ec2
Hostname 3.333.33.333
User ec2-user
IdentityFile C:\path\to\credfile.pem
Then you will be able to select the entry 'ec2' after selecting 'remote-ssh connect current window to host'
Well I was smart enough to put an exit 0 in one of my dotfiles on a remote machine. Whenever I log in, the shell exits instantly now. How can I ssh into a machine without sourcing all the dot files?
I found a workaround to solve this problem by directly running a command:
ssh -t remotehost vim /dotfile/i/had/to/revert
I am transferring a project folder to AWS instance using PuTTY pscp.
I am able to connect using .ppk public keys file and ssh command opened successfully and logged-in.
Here I am using command to transfer folder:
pscp -r -i C:\path-to-my-keys\converted-pem-keys.ppk d:\MyDevelopment\myproj ec2-user#xx.xxx.xxx.xxx:/home/ec2-user/myproj
It shows:
pscp: Command not found.
Path to PuTTY folder is set in Environment variables. Any idea?
"Command not found" is a common *nix shell error message. What indicates that you probably type the pscp command in PuTTY (remote) terminal.
But pscp is Windows application. You have to type your pscp command in (local) Windows console (cmd.exe or PowerShell).
I am using Plink to execute remote command:
When using remote command (text file) error occurs:
FATAL ERROR: Server unexpectedly closed network connection
test.bat
"C:\Program Files (x86)\PuTTY\plink.exe" XX.XX.XX.XX -l userID -pw password -m "D:\FindingLog\test.txt"
test.txt
cd log
When I remove -m "D:\FindingLog\test.txt" in batch file, it works (successful login)
What's the problem?
The SSH session closes (and Plink with it) as soon as the command finishes. Normally the "command" is shell. As you have overridden this default "command" and yet you seem to want to run the shell nevertheless, you have to explicitly execute the shell yourself:
cd log
/bin/bash
Also as use of -m switch implies a non-interactive terminal, you probably want to force an interactive terminal back using -t switch.
See also How to prevent PuTTY shell from auto-exit after executing command from batch file in Windows?
Upgrading to plink 0.74 fixed this issue for me (from much older version 0.60).
I have a linux shell script file which collects various data from linux server. (Services, Process, FreeSpace etc.).
From windows to collect the data we are using Plink to connect to linux Boxes and run the shell script
plink root#servername -pw Password -noagent -m Batch-File.
and using pscp to copy the file to windows location.
Now when I try to do the same for Esxi the plink command fails with the error below.
FATAL ERROR: Server unexpectedly closed network connection
though If i give a direct command as below.
plink root#servername -pw Password -noagent ls /etc
works out.
Let me know how to use the plink for esxi .. if possible.
After seeing the messages log it looks like that the issue is with esxi's limitation to read long character string. The message log fails in the session with String Too Long and then post a message of closing the connection.
Thus the approach was to copy the shell script as a pscp connection, run the file with executable permission and collect the data gathered and delete the file from system.