Cygwin: ssh and ssh-keygen do not react at all - ssh

I've got a strange behaviour of ssh and ssh-keygen: they do not react at all. Cygwin is started with admin rights and works normally. The host 192.168.1.1 is up and I can remote desktop to it:
When I try:
$ ssh -vvv pi#192.168.1.1
OpenSSH_8.3p1, OpenSSL 1.1.1f 31 Mar 2020
I get only one line but nothing else, even if I wait hours. I reinstalled cygwin, openssh, I deleted the .ssh folders, no success.
When I enter
ssh-keygen -b 4096
nothing happens at all. For me it seems that the user interaction does not work. Any ideas?
Thanks
Update: I tried:
reinstalling cygin for all users, one user, running the installation with admin rights, without. No success.
Started ssh and ssh-keygen with an absolute path to make sure that the windows openssh is not used
Checked the folder permissions on .ssh
Here is my strace: Pastebin
Update 2: I found the following: if I run ssh-keygen or ssh often enough (!) it will sometimes work! Now that's weird.

Philippe had the right idea. Basically the citrix workspace app is crashing ssh cygwin. When I uninstalled citrix everything worked fine!

I found that it is down to a bug in epclient64.dll of citrix: it crashes my ssh in my internal network. After uninstallation of citrix it would work normally. Here is the log
Pastebin log of strace
https://pastebin.com/FJfUj3C1[Pastebin][1]
Without the app protection it works fine. So to sum up:
with app protection ssh crashes again and again, it does not even start properly
without citrix ssh works fine
citrix without app protection ssh works fine
--> epclient64.dll does not work with ssh
And we are talking about the most recent versions of ssh & citrix as of Jan 2021.

I found that when I uninstalled citrix, it had no effect.
I opened up the folder in Windows Explorer where the ssh.exe resides. I right clicked on this executable, navigated to Compatibility tab, selected Run this program in compatibility mode for "Windows 8". Then I at least got a response from the command line, but it would never connect to the host I entered. It would get stuck and I would have to kill it from taskmgr.
When I ran whereis ssh, I had 2 versions in Cygwin, one in /usr/bin and one in /cygdrive/c/WINDOWS/System32/OpenSSH. So what I did was to move the /usr/bin version to a backup file and create a link in a cygwin shell to /cygdrive/c/WINDOWS/System32/OpenSSH/ssh.exe. Now it works like it used to.
By the way my OpenSSH version is "OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5" running on Windows 10.

Related

Cygwin disappeared on its own and messed up my downloads folder permissions (I think)

I am trying to get Autossh to work with Cygwin.
I followed this guide loosely:
http://tutorialspots.com/how-to-create-ssh-tunnel-on-windows-by-using-autossh-2984.html
I managed to get as far as setting up my ssh keys ad ssh'ing into my server. I did that by copying my windows .ssh folder into the one that Cygwin uses with the cp command, so I skipped the key-generating section of the guide since I have my own.
I installed the packages AutoSSH, OpenSSH, OpenSSL, Zip, Unzipsnd also vim.
So here's the really weird part:
I copied the ssh keys, ssh'ed into my server and all went fine. Then tried to use autossh with the -M command, but everything was gone. It's like the /usr/bin folder disappeared.
Then I saw that the installation file i got from https://cygwin.com/ also disappeared. And the shortcuts on my desktop and start menu has also deleted itself.
This has happened twice now after successfully ssh'ing into my server once. So it seems on the second attempt, everything deletes itself.
Even worse, when I try to download the installation file into my Downloads folder in my user directory, chrome says "Failed: Insufficient permissions".
Interestingly it only does this with the installation file. I can download any other files from any other location(it seems). If I tell chrome to use a different download folder, I can suddenly download cygwin again.
I am so confused.
Can anyone help?

How to install Terraria TShock Server on Ubuntu Server?

Recently I decided to install Terraria server on Ubuntu Linux, but didn't find any completed instructions, so I decided to make my own, to help pure Terraria fans like me. This arcticle is relevant on 15.02.2019.
So first of all, you need a dedicated server. I used vps server from Heztner guys, but you can use any kind of tech you want (like raspberry pi or old pc with Ubuntu Server installed. Just make sure its minimal configuration fits Terraria Server).
After you first powered up your device and created password, we'll install SSH to make our setting up process a little bit comfy. You will be able to access server with any other device, if you have ssh installed in cmd or terminal.
Windows 10
Has SSH preinstalled in cmd. So all you need to do is
Type ssh-keygen (it will ask you to point the folder to extract keys, you can do it or just press enter)
Type ssh-copy-id "username"#"yourdeviceip" (Example: root#116.23.106.75)(In username type root)
Enter root password and you're in ')
Ubuntu 18.04
You may need to enable SSH in terminal. Use this instruction. Process is the same as in cmd on Windows 10.
Also
You can use SSH clients like Termius, you just need to create new Host with enabled SSH and put your server ip. Then choose user and enter password, and you're in.
Finally we're done with SSH and begining to setup our working environment. To fully operate with our system, we need to install several programs, as
mono-complete (to emulate windows shell environment, so TShock can work properly)
screen (to detach our terraria server screen)
unzip
And finally our Terraria server
Installation
First we create different user, so we store Terraria files separately of root.
adduser terraria
Then add it to sudo group, so you can launch several admin commands
adduser terraria sudo
Then install programs
sudo apt-get install mono-complete screen unzip
Enter as terraria user
su terraria
Go to your home folder
cd
Download latest TShock file, for me it's 4.3.25. If there is newer version, just go to their github page and copy zip file download link and paste it instead of mine.
sudo wget https://github.com/Pryaxis/TShock/releases/download/v4.3.25/tshock_4.3.25.zip
Unzip it
unzip tshock_4.3.25.zip
Delete zip-file
rm tshock_4.3.25.zip
Execute server one time to create the map
mono-sgen TerrariaServer.exe (type it every time you want to launch the server)
And now, when the map created and launched, you simply press ctrl+a to start screen, and then press d. Now your screen is detached and you can use your console regardless of server. Also this wont let your Terraria process shut down because of inactivity.
Bonus level
And this part will be for people who want to transfer their local map to server. I did it because first time I played Terraria with friends through Steam, and then I created server so map can run 24/7.
All you need to do is create ssh connection from device you store your local map. If you did it previously, then go to your Steam folder, find Terraria worlds, right click, properties and copy the path. Then go to cmd and type
scp "yourworldpath" terraria#*yourserverip*:~
It will copy your local world to home section, then go back to your ssh with terraria user and type
cd
mv "yourworldname" .local/share/Terraria/Worlds/
That thing will move your world file to hidden .local folder, where all world files store. Aaaand that's all. Just go to number 8 and do it again. Hope this guide will help you:) If you find any mistakes or face with problems, just comment this section, so I can fix it.

Vagrant disable SSH Agent

Getting the following when I am trying to run Vagrant up.
Have tried to re-provision etc. Even tried rolling back (in Time Machine) the user/vagrant-local directory & the vagrant-local directory where the sites all live.
An error occurred in the underlying SSH library that Vagrant uses. The
error message is shown below. In many cases, errors from this library
are caused by ssh-agent issues. Try disabling your SSH agent or
removing some keys and try again.
If the problem persists, please report a bug to the net-ssh project.
timeout during server version negotiating
I was getting this exact error.
I upgraded from VirtualBox 5.0.x to 5.1.8 and the error went way.
After upgrading I did vagrant destroy and then vagrant up and the machine booted up without issues.
So this is what I have now:
Windows 10 pro
Vagrant 1.8.7
VirtualBox 5.1.8
I also made sure everything else was updated. Don't forget to reboot.
Hope this helps.
I have faced the same issue and done the following:
Send shutdown command to your VM (virtual machine)
Run the command again: vagrant up
ssh issue was resolved after this as VM has been restarted again.
I just had the same issue on this setup:
Windows 11
Vagrant 2.3.1
VirtualBox 6.1.38
What seems to have solved the problem for me is this:
run vagrant destroy -f
temporarily disable "Use the WSL2 based engine" from Docker Desktop. Wait for Docker Desktop restart.
run vagrant up --debug. The problem is still reported, but this time Vagrant recovers and runs to the end
Verify vagrant ssh is working
Re-enable "Use the WSL2 based engine". Wait for Docker Desktop restart.
Verify things are still working (also after re-boot)

Can Vagrant suffice my requirement?

I have been looking out for ways to setup an automation environment and I found this application named Vagrant. I read the docs on the site, however I wanted to know from the experts out there if Vagrant with Oracle VirtualBox would suffice my needs.
I need to have a script that will call Vagrant to initialize a VM [The VM-Image is always the same - Windows Server 2008 R2]
I need to copy some of my project related files from a shared location onto the VM
Call a Batch file that will take care of test runs for me inside the VM
Once my test run is complete, This VM needs to be self destroyed/destructed.
Also, I would like to know if the Image be a custom .ISO file?
Sounds like Vagrant and VirtualBox will work for that scenario. Also, you might find that running commands in the VM using WinRM or SSH may be the easiest way to launch tests.
If you haven't already seen it, the blog post about Windows support in Vagrant 1.6 is informative: https://www.vagrantup.com/blog/feature-preview-vagrant-1-6-windows.html
Creating a VirtualBox/Vagrant base VM from an .iso should work, and you can then do all of your work using the VM from that point onward.
To get started, you might try these steps:
Create a VirtualBox VM from your Windows .iso, using the VirtualBox GUI or cmdline tools.
Once you have the VM in the state you want it, shut it down and package it as a vagrant box - for example, on a Mac that step looks like (where Win7x64 is the dir containing the VirtualBox VM):
cd ~/VirtualBox\ VMs
vagrant package --base Win7x64 --output win7x64_base.box
Once that finishes, tell vagrant about the new base box:
vagrant box add win7x64_base /path/to/win7_base.box
Then you can vagrant init/vagrant up the VM:
mkdir win7 && cd win7
vagrant init win7x64
vagrant up
To enable SSH access, I installed Cygwin in the VM and configured sshd. So, after launching you can SSH in by running vagrant ssh
Note that if there's no Windows user in the VM named 'vagrant', you can specify the SSH username to use with vagrant ssh by placing this in your Vagrantfile:
config.ssh.username = 'user1'
As mentioned above, WinRM is also an option for remotely running commands.
And Vagrant apparently has some convenience features to make it easy to RDP into the VM, but I haven't looked at that.

xquartz: couldn't query security extension and xterm failing

I am using OSX 10.7.5 from my MacBook Air to login to remote Linux workstation, running Suse (/etc/issue: SUSE Linux Enterprise Desktop 11 SP2 (x86_64) - Kernel \r (\l))
Everything was working fine until I started to play with macports latest X11, XQuartz XWindow System (XQuartz 2.7.4 (xorg-server 1.13.0)). By default OSX 10.7.5 comes with XQuartz 2.6.4 (xorg-server 1.10.6), however I've installed and made default XQuartz 2.7.4. I am now observing two issues:
(1) When logging to my remote Suse box (this is done via VPN tunnel btw, not sure if it matters), via 'user1> ssh -X user2#wks01' I am getting
Warning: untrusted X11 forwarding setup failed: xauth key data not generated
This (at least appears) to be traced to the fact that there's no 'Security' extension on the new Xquarts server. Traced via ssh -vvv option, and then due to the fact that xauth is failing, so running it separately on MacBox, or remote Suse gives:
user2#wks04:~> xauth generate "$DISPLAY" .
trustedxauth: (argv):1: couldn't query Security extension on display "localhost:10.0"
'ssh -Y' logs in without warning
(2) What is also interesting, that in both ssh modes -X and -Y I am able to open and forward to my display any X-application that I have checked, including xclock, xlogo, xcalc and even eclipse. However running simple 'xterm' results in a hanging job (i.e. appears running), but xterm never displays on my Mac.
While rolling back to will XQuartz 2.6.4 probably help with the issues above (as all the above operations worked smoothly before), but I am curious now to understand the root of the matter.
Thank you in advance for your help,
Dmitry