Can't connect to server via mosh - ssh

I started the server on Debian, installed all the necessary settings and connected the SSH key. I connect to the server:
ssh -i yandex_key rhost#51.250.1.155
Terminal output:
Linux rhost 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Nov 8 12:56:48 2021 from 31.181.120.181
I run a mosh-server on the server:
mosh-server (mosh 1.3.2) [build mosh 1.3.2]
Copyright 2012 Keith Winstein <mosh-devel#mit.edu>
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[mosh-server detached, pid = 1739]
I go back to my local machine and run the mosh-client:
mosh-client (mosh 1.3.2) [build mosh 1.3.2]
Copyright 2012 Keith Winstein <mosh-devel#mit.edu>
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Usage: mosh-client [-# 'ARGS'] IP PORT
mosh-client -c
I run the command in the terminal:
MOSH_KEY=YfK...qoQ mosh-client 51.250.1.155 60001
return:
mosh did not make a successful connection to 51.250.1.155:60001.
Please verify that UDP port 60001 is not firewalled and can reach the server.
(By default, mosh uses a UDP port between 60000 and 61000. The -p option
selects a specific UDP port number.)
[mosh is exiting.]
I try to connect using other commands mosh [rhost#]51.250.1.155 mosh rhost#51.250.1.155, there is no result. I contacted server support but they said the problem was on my side. What could be the problem? I need help.

Make sure you have UDP ports 60000-61000 open in your firewall.

Related

EtherCAT with SOEM on WSL Ubuntu 18

Has anyone ever tried connecting to an EtherCAT device via SOEM in WSL linux?
While TwinCAT successfully connects to my Maxon EPOS4 and moves a DC motor on my laptop under Windows 10 using RT-Ethernet Intermediate Driver, SOEM slaveinfo returns no slaves found on eth0 under WSL.
Ps. I use an ethernet to usb-c LAN adaptor with my laptop, automatic IP address, Ubuntu 18.04 on WSL 2 with Hyper-V installed, and tested turning off my windows firewall too. I have not used SOEM under windows yet due to compile issues. Initially, I had no socket found on eth0 issue, but it solved after installing hyper-V and upgrading my WSL current installation of Ubuntu-18.04 to WSL 2.
I have the same issue under WSL Ubuntu 20, when the firewall is deactivated, if I disable all TwinCAT services and uninstall the TwinCAT items from the Ethernet Properties window!
Here is what I do and the outputs:
$ sudo setcap cap_net_raw+ep /opt/ros/melodic/bin/slaveinfo
$ sudo /opt/ros/melodic/bin/slaveinfo
SOEM (Simple Open EtherCAT Master)
Slaveinfo
Usage: slaveinfo ifname [options]
ifname = eth0 for example
Options :
-sdo : print SDO info
-map : print mapping
Available adapters
Description : lo, Device to use for wpcap: lo
Description : bond0, Device to use for wpcap: bond0
Description : dummy0, Device to use for wpcap: dummy0
Description : eth0, Device to use for wpcap: eth0
Description : sit0, Device to use for wpcap: sit0
End program
$ sudo /opt/ros/melodic/bin/slaveinfo eth0
SOEM (Simple Open EtherCAT Master)
Slaveinfo
Starting slaveinfo
ec_init on eth0 succeeded.
No slaves found!
End slaveinfo, close socket
End program
Can you elaborate on your Ethernet controllers? Do you have the one USB-C adapter setup with TwinCAT and the RT-Ethernet driver? If so, I would expect that SOEM running in Ubuntu under WSL does not have access to this controller.
I would test on a system without TwinCAT installed, or rollback the TwinCAT RT-Ethernet driver installation so that the Ethernet controller is available to Windows and presumably WSL. Or can you have an additional adapter that isn't available to TwinCAT?
For me on windows eth0 would not work for epos4. I had to write getmac in a console and copy the line
\Device\Tcpip_{------- copy this part ------}.
Then in my code i would write
init_comm("\\Device\\NPF_{--- your copied part ---}");

SSH not working in MacBook Pro 2019 Catalina

I have spent a few hours hunting for the problem here.
I have been working with Macs for years now and never had this problem, and have ssh into eC2 instances thousands of times.
I recently received at work a new MacBook Pro.
SSH runs as a service, meaning here it does not return any error that it is not found.
But no matter what server or EC2 instance I try to ssh into, as I have done a million times before I get a timeout.
Before you ask, I have looked all over for this problem. I have also looked for the normal ~/.ssh directory, which seems to be missing and therefore cannot find any config file.
The following is the Mac info:
Catalina 10.15.2
Model Name: MacBook Pro
Model Identifier: MacBookPro16,1
Processor Name: 8-Core Intel Core i9
Processor Speed: 2.3 GHz
Number of Processors: 1
Total Number of Cores: 8
L2 Cache (per Core): 256 KB
L3 Cache: 16 MB
Hyper-Threading Technology: Enabled
Memory: 16 GB
Boot ROM Version: 1037.60.58.0.0 (iBridge: 17.16.12551.0.0,0)
Serial Number (system): C02ZNMV5MD6N
Hardware UUID: 27B1EDF5-B1D2-5F86-BD12-D646F36D9D2D
Activation Lock Status: Enabled
ETA: Yes, from a Windows machine I can access the EC2 network. Yes, I have the correct PEM file. And yes, I have made sure security groups in AWS are correct. For some reason the normal ssh -i etc. picked up directly from AWS connect for the EC2 instance always times out.
Crazy question: does the ssh in Catalina demand another command, addition or some other parameter besides -i?
(I do not seem to be able to ping, telnet etc. either. So something seems to be preventing the OS from going out on ssh port 22.)
Does anyone know of or has had this problem and a fix for it? I am fairly sure it is some type of configuration in ssh or in the Network configurations.
It is driving me crazy. Any and all help would be greatly appreciated!
New Macbook Pro owner/user here. Same issue, despite all configs being identical to my Windows 10 pc and Ubuntu 20 laptop.
For some reason, this doesn't work for me on my Macbook, but does work on Windows and Ubuntu.
ssh -i path-to-keyfile.pem user#ipaddress
But creating an SSH config file and adding my AWS keyfile to my keychain works:
open ~/.ssh/config if the config file exists, or touch ~/.ssh/config if not.
Edit this config file as follows:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Note: I don't know for sure, but I imagine only the 'AddKeysToAgent' and 'UseKeychain' parts are what's important. I'm using the 'IdentityFile' part for connecting to my git repos.
Save the config file and exit. Next, make sure your keyfile isn't too open, otherwise you won't be able to add it to your keychain:
chmod 600 path-to-keyfile.pem
Finally, add the keyfile to your keychain:
ssh-add -K path-to-keyfile.pem
Now on Mac, I'm able to ssh into my AWS instance without the -i flag:
ssh aws-username#aws-ipaddress
Hope this helps. I found the solution here: https://www.cloudsavvyit.com/1795/how-to-add-your-ec2-pem-file-to-your-ssh-keychain/
PS - I'm also unable to sFTP into AWS using Filezilla on Mac, so I'm looking into this as well.
Update on Filezilla: A bit bizarre and I haven't figured out how to save my settings, but for now this answer works: https://superuser.com/questions/280808/filezilla-on-mac-sftp-with-passwordless-authentication

GPG key forwarding on Debian

I'm trying to use the private key from my openpgp card from my Debian laptop to a RPi. I followed the different hints found on google, in particular:
extra-socket in ~/.gnupg/gpg-agent.conf
removed it again when founding that this extra socket already will be created in /run/user/<uid>/gnupg
forward this socket using ~/.ssh/config
Host homegear
HostName homegear
RemoteForward ~/.gnupg/S.gpg-agent /run/user/1000/gnupg/S.gpg-agent.extra
changed the order of the both sockets in the RemoteForward line since I'm always confused which one should be the first one
add the following into /etc/ssh/sshd_config of the RPi
StreamLocalBindUnlink yes
reload the gpg-agent on the laptop
open new ssh connection to RPi
But I always get
Warning: remote port forwarding failed for listen path ~/.gnupg/S.gpg-agent
when connecting to the RPi.
openssh on both laptop and RPi is 7.4 (Debian Stretch), gpg is 2.1.18.
Forwarding the agent connect to be used as ssh private key (for connecting to gitlab from RPi) works perfectly, forwarding gpg private key (for signing commits) doesn't. I'm a bit helpless at the moment. Is there anything obviously wrong? Or is there still a problem with forwarding unix domain socket and I need to use the socat workaround?
Thank you!
I've run into exactly the same issue except between two Macs running 10.14.2 and GPG 2.2.11, and the only way I was able to get it to work was to specify the absolute path to the sockets on both ends. :( Having a relative path for either the remote or local socket both failed in various ways, which makes it a bit of a pain if you're connecting as different usernames on various machines.
I was able to work around that by specifying a number of different Match exec blocks in my ~/.ssh/config:
# Source machine is a personal Mac, connecting to another personal Mac on my local network
Match exec "hostname | grep -F .core" Host *.core
RemoteForward /Users/virtualwolf/.gnupg/S.gpg-agent /Users/virtualwolf/.gnupg/S.gpg-agent.extra
# Source machine is a personal Mac, connecting to my Linux box
Match exec "hostname | grep -F .core" Host <name of the host block for my Linux box>
RemoteForward /home/virtualwolf/.gnupg/S.gpg-agent /Users/virtualwolf/.gnupg/S.gpg-agent.extra
# Source machine is my work Mac, connecting to my Linux box
Match exec "hostname | grep -F <work machine name>" Host <name of the host block for my Linux box>
RemoteForward /home/virtualwolf/.gnupg/S.gpg-agent /Users/<work username>/.gnupg/S.gpg-agent.extra
(SSH bits are taken from this answer).

connecting to a remote lisp without SSH

I am trying to connect to a remote lisp, which is running on a virtual machine on my laptop. In the slime manual, I found this line
there is a way to connect without an ssh tunnel, but it has the side-effect of giving the entire world access to your lisp image, so we’re not going to talk about it
This seems a bit dated. I would imagine that running the lisp on a virtual machine will not allow any one else to access the lisp.
My question is, how do I connect to a remote lisp without SSH?
[EDIT]
I have seen the question here, but when I forward the port, slime is not able to connect to swank and gives me the following error
Lisp connection closed unexpectedly: connection broken by remote peer
You could use quicklisp and swank in the virtual machine then forward the port you open the lisp following this tutorial or the one for the environment you use for virtualization.
In your lisp on the virtual machine:
Welcome to Clozure Common Lisp Version 1.11-r16635 (DarwinX8664)!
CCL is developed and maintained by Clozure Associates. For more information
about CCL visit http://ccl.clozure.com. To enquire about Clozure's Common Lisp
consulting services e-mail info#clozure.com or visit http://www.clozure.com.
? (ql:quickload :swank)
To load "swank":
Load 1 ASDF system:
swank
; Loading "swank"
.....
(:SWANK)
? (swank:create-server)
;; Swank started at port: 4005.
4005
?
then use slime-connect to connect to your virtual machine ip and the port you choose for the swank-server.
In other case for ssh is also easy.if you want to connect to one port in one remote machine using ssh the easy way is using the -L option like this
ssh user#ip -p22 -L local_port:localhost:remote_port
then you use slime-connect and connect to localhost and the local_port
This is a setup using vagrant, only connect to ssh to the machine to startup swank, but you can automatize it.
1) Vagrantfile: with the forwarding port and the ip, and the roswell setup, you can install directly sbcl, it is not important but with roswell is easy to get lisp up and running in a minute, the important thing here is having quicklisp running.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 4005, host: 4005
config.vm.network "private_network", ip: "192.168.33.24"
config.vm.provider "virtualbox" do |vb|
vb.name = "lisp_host"
vb.gui = false
vb.memory = "1024"
end
config.vm.provision "shell",
inline: "apt-get update
if which apt-get > /dev/null; then sudo apt-get -y install git build-essential automake libcurl4-openssl-dev;fi
git clone -b release https://github.com/roswell/roswell.git
cd roswell
sh bootstrap
./configure
make
sudo make install
sudo ros setup"
# SHELL
end
2) vagrant up amd vagrant ssh to go inside the machine
3) ros run -Q #after installing the sbcl you can use quicklisp in the REPL
4) Preparing swank
2016-06-06 12:32:55 ☆ |ruby-2.2.3#laguna| Antonios-MBP in ~/learn/lisp/stackoverflow/vagrant-env
○ → vagrant ssh
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-79-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Mon Jun 6 10:26:56 UTC 2016
System load: 0.41 Processes: 84
Usage of /: 4.7% of 39.34GB Users logged in: 0
Memory usage: 12% IP address for eth0: 10.0.2.15
Swap usage: 0% IP address for eth1: 192.168.33.24
Graph this data and manage this system at:
https://landscape.canonical.com/
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
Last login: Mon Jun 6 10:26:56 2016 from 10.0.2.2
vagrant#vagrant-ubuntu-trusty-64:~$ ros run -Q
WARNING: Setting locale failed.
Check the following variables for correct values:
LC_CTYPE=UTF-8
LANG=en_US.UTF-8
* (ql:quickload :swank)
To load "swank":
Load 1 ASDF system:
swank
; Loading "swank"
.
(:SWANK)
* (setf swank::*loopback-interface* "192.168.33.24") ;Important to listen throught the internet IP
"192.168.33.24"
* (swank:create-server)
;; Swank started at port: 4005.
4005
5) Then go to you emacs environment:
slime-connect
host 192.168.33.24
port 4005
6) maybe the version is different accept it and go on
Finally you can use it
I believe that this tricks could work for you the most important is the swank::loopback-interface

Apache benchmark issue: An address incompatible with the requested protocol was used. (windows)

I want to benchmark my site and I found out that apache can do that for me with quite good statistics but unfortunately I fail. What I do is in my cmd prompt I navigate to apache\bin ( I'm on windows thus \ ) and run the following
ab -n 1000 -c 5 http://localhost/
 What I get is:
This is ApacheBench, Version 2.3 <$Revision: 1178079 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
bind: An address incompatible with the requested protocol was used. (730047)
Since I'm not really an expert I don't really know where to go from here.. Any advice?
Just bumped into a very useful article, of course after asking a question.
Basically what I did was I had to open C:\Windows\System32\drivers\etc\hosts with admin privileges and add
::1 localhost
below
127.0.0.1 localhost
Source: http://crossplatform.net/apachebench-localhost-bind-problem/