I know there are several "SHH Permission Denied" questions out there but noting really worked for me.
I am trying to connect to my raspberry pi (Rasbian Butcher) from my PC (Windows 10; Version 1903) using ssh but I get following error:
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug3: Failed to open file:C:/Users/user_name/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolving "smarthome" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to smarthome [192.168.178.24] port 22.
debug3: finish_connect - ERROR: async io completed with error: 10013, io:0000024AC4D4EAA0
debug1: connect to address 192.168.178.24 port 22: Permission denied
ssh: connect to host host_name port 22: Permission denied
I already tried reseting my firewall to default, to deactivate it, to reinstall ssh server and client on windows.
Does any of you has another idea?
I should add:
-ssh is enabled
-I can access the same raspberry pi with a linux machine on the same network so it must be somehow a win10 probelm
Related
While my Linux machines can access the hosted repositories on the NAS using its hostname, my Windows machine fails to access it from command line / Visual Studio Code. During my debugging attempts I found a way so that at least TortoiseGit can access the repositories: I had to add an env var GIT_SSH_COMMAND=ssh -vvv (besides the already existing GIT_SSH=C:\Program Files\TortoiseGit\bin\TortoiseGitPlink.exe).
When I issue a git pull via cmd for a repository accessed in Git config via url = ssh://gituser#my-devices-hostname/volume1/git/reponame.git I get the following output:
OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving "my-devices-hostname" port 22
debug2: ssh_connect_direct
debug1: Connecting to my-devices-hostname [192.168.0.50] port 22.
getaddrinfo: atch: Name or service not known
ssh: connect to host my-devices-hostname port 22: failure
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
When I replace the hostname by a static IP I get the same error:
OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname 192.168.0.50 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.0.50 [192.168.0.50] port 22.
getaddrinfo: atch: Name or service not known
ssh: connect to host 192.168.0.50 port 22: failure
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
When doing the same with TortoiseGit, everything works fine, I get:
OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving "my-devices-hostname" port 22
debug2: ssh_connect_direct
debug1: Connecting to my-devices-hostname [192.168.0.50] port 22.
debug1: Connection established.
...
I've recently set up a new DSL router (Fritz!Box 7590), maybe this is somehow related. Since I guessed that the problem could be related to IPv6, I've disabled IPv6 on the Synology NAS, but no change.
Update:
fedrik asked me to perform a manual ssh. Here are the results:
ssh gituser#my-devices-hostname
fatal: Interactive git shell is not enabled.
hint: ~/git-shell-commands should exist and have read and execute access.
Connection to my-devices-hostname closed.
and surprisingly:
ssh gituser#196.168.0.50
ssh: connect to host 196.168.0.50 port 22: Connection timed out
I updated my Git- and Tortoise installation, now I get
ssh gituser#192.168.0.50
fatal: Interactive git shell is not enabled.
hint: ~/git-shell-commands should exist and have read and execute access.
Connection to 192.168.0.50 closed.
The hostname based ssh remained the same.
Inspired by the answer from VonC, I checked if there are multiple instances of ssh installed on my system. I found the following:
C:\Windows\System32\OpenSSH\ssh.exe
C:\Program Files\Git\usr\bin\ssh.exe
So I checked (after updating Tortoise and Git for Windows), which one is used. First, I left GIT_SSH_COMMAND=ssh -vvv:
git pull
OpenSSH_8.4p1, OpenSSL 1.1.1h 22 Sep 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/c/Users/user/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/c/Users/user/.ssh/known_hosts2'
debug2: resolving "my-devices-hostname" port 22
debug2: ssh_connect_direct
debug1: Connecting to my-devices-hostname [192.168.0.50] port 22.
getaddrinfo: atch: Name or service not known
ssh: connect to host my-devices-hostname port 22: failure
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
"C:\Program Files\Git\usr\bin\ssh.exe" -vvv gituser#192.168.0.50
OpenSSH_8.4p1, OpenSSL 1.1.1h 22 Sep 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolve_canonicalize: hostname 192.168.0.50 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/c/Users/bjoer/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/c/Users/bjoer/.ssh/known_hosts2'
debug2: ssh_connect_direct
debug1: Connecting to 192.168.0.50 [192.168.0.50] port 22.
debug1: Connection established.
After I changed the env var: GIT_SSH_COMMAND=C:/Windows/System32/OpenSSH/ssh.exe -vvv I got this:
git pull
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug3: Failed to open file:C:/Users/user/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolving "my-devices-hostname" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to my-devices-hostname [192.168.0.50] port 22.
getaddrinfo: atch: Der angegebene Host ist unbekannt.
ssh: connect to host my-devices-hostname port 22: failure
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
C:\Windows\System32\OpenSSH\ssh.exe -vvv gituser#192.168.0.50
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug3: Failed to open file:C:/Users/user/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolve_canonicalize: hostname 192.168.0.50 is address
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 192.168.0.50 [192.168.0.50] port 22.
debug1: Connection established.
When I unset GIT_SSH and GIT_SSH_COMMAND env vars, I get this:
git pull
getaddrinfo: atch: Name or service not known
ssh: connect to host my-devices-hostname port 22: failure
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
So, I can connect via SSH to the Git server, but when issues from the Git executable itself, it fails.
When I launch up a WSL on the same machine, I can perform a git pull without problems.
Any suggestions on how to tackle this issue?
Although this issue appeared somewhat after I installed a new router, the root cause was a defective setup of the Git server on my Synology NAS. After setting up the Git server from scratch following these steps, everything worked fine again:
Setup user and folder
Install WebDAV package via Diskstation Package Manager
Configure WebDAV: Enable HTTP on port 5005 and HTTPS on port 5006
Control Panel -> File Services -> SMB -> Advanced Settings -> Set min and max SMB protocols to SMB1 and SMB3
Create user gituser via Diskstation interface (group users, no access to shared folders, with File Station and WebDAV privilages)
Add new shared folder called git (located at /volume1/git) with read/write access for gituser. This folder will hold all the repos.
Install Git Server package via Diskstation
Open Git Server and allow gituser permissions (one has to login as "admin" to see the available users)
Enable SSH access on Diskstation (Control Panel > Terminal & SNMP > Enable SSH Service)
Activate user home service (Control Panel > Users > Extended > Userbase > Activate user home service)
Configure SSH Access
create ~/.ssh folder for gituser on server
sudo su
mkdir /volume1/homes/gituser/.ssh
create a private/public key pair via PuTTYgen (SSH-2 RSA, 2048 bits)
copy the public key show at top of the window to a file named authorized_keys
copy that file from local computer to gituser account on server
scp authorized_keys username#nas:/volume1/homes/gituser/.ssh
change permissions while logged in as root
cd /volume1/homes/gituser/
sudo chown -R gituser:users .ssh
sudo chmod 700 .ssh
sudo chmod 644 .ssh/authorized_keys
sudo chmod 755 /volume1/homes/gituser
activate public key SSH access by setting the following properties in /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys
disable and then re-enabled the SSH service (Control Panel > Terminal & SNMP > Enable SSH Service)
I was getting this error as a result of setting git config --global ssh.variant plink. By setting git config --global ssh.variant ssh, this error went way. The problem seems to be that git was passing a -batch option, which plink was interpreting as a -b option (hence the strange error involving "atch".
I would try the same ssh call without GIT_SSH set
set GIT_SSH=
With a recent Windows 10, openSSH is either directly installed or provided with Git For Windows.
Make sure to use the latest version of Git, and add its usr/bin folder to your PATH.
Currently, I am trying to scp from a remote server (a computer cluster) to my local MAC OSX. However, whenever I try to send a file from the cluster to my computer, I get this error.
ssh: connect to host 73.232.71.182 port 22: Connection timed out
lost connection
Ssh is installed correctly and which scp gives the desired output and this is the output of ssh -v localhost.
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017
debug1: Reading configuration data /s1/snagaraj/.ssh/config
debug1: /s1/snagaraj/.ssh/config line 2: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to 73.232.71.182 [73.232.71.182] port 22.
debug1: connect to address 73.232.71.182 port 22: Connection timed out
ssh: connect to host 73.232.71.182 port 22: Connection timed out
Edit 1: What would you want me to check? Ping seems to work and the traceroute command works (but I do not want to reveal the output as it shows where I live).
I'm having an absolute nightmare of a time getting a working ssh connection to github. I know I've gotten it working in the past, but can't for the life of me remember how.
Debug output:
debug2: ssh_connect: needpriv 0
debug1: Connecting to github.com [192.30.253.113] port 22.
debug1: socket:660, io:0000025981539ED0, fd:3
debug3: w32_fcntl fd:3
debug3: w32_connect fd:3
debug3: connect - io:0000025981539ED0
debug3: connectex - io:0000025981539ED0
debug3: wait() on 1 events and 0 children
debug3: finish_connect, io:0000025981539ED0
debug1: finish_connect - ERROR: async io completed with error: 107, io:0000025981539ED0
debug1: connect to address 192.30.253.113 port 22: Unknown error
debug3: w32_close fd:3
debug1: close - io:0000025981539ED0, type:1, fd:3, table_index:3
debug2: close - io:0000025981539ED0
ssh: connect to host github.com port 22: No error
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
and https://www.eldos.com/documentation/sbb/documentation/ref_err_ssherrorcodes.html says that an SSH error code of 107 corresponds to the ERROR_SSH_SERVICE_NOT_AVAILABLE error. Doesn't really tell me much.
I've attempted to try explicitly tunnelling through my proxy, but that has had no luck. Utilising my ssh config, I've got it set to the following:
Host github.com
User git
BatchMode yes
LogLevel DEBUG3
ProxyCommand ncat --proxy $http_proxy --proxy-type http %h %p
That just ends up spitting-out another error:
proxy connect is not supported in Windows
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I'd really appreciate it if anyone can at least give me some more avenues of investigation, if not an actual solution.
The closest issue I've been able to find is Not able to connect to github repo via ssh using http proxy tunnel, but that requires corkscrew, and getting that compiled on my windows machine is reasonably difficult (though I'm still trying).
Edit: The standard help documentation for github isn't much use in this case, since the error I'm getting isn't related to key authentication. Running the suggested ssh -T git#github.com results in pretty much the same error:
debug2: ssh_connect: needpriv 0
debug1: Connecting to github.com [192.30.253.112] port 22.
debug1: socket:612, io:000001AB50DC8A90, fd:3
debug3: w32_fcntl fd:3
debug3: w32_connect fd:3
debug3: connect - io:000001AB50DC8A90
debug3: connectex - io:000001AB50DC8A90
debug3: wait() on 1 events and 0 children
debug3: finish_connect, io:000001AB50DC8A90
debug1: finish_connect - ERROR: async io completed with error: 107, io:000001AB50DC8A90
debug1: connect to address 192.30.253.112 port 22: Unknown error
debug3: w32_close fd:3
debug1: close - io:000001AB50DC8A90, type:1, fd:3, table_index:3
debug2: close - io:000001AB50DC8A90
ssh: connect to host github.com port 22: No error
I have run out of options. I have tried several methods but none have worked so I hope someone can help me.
At work we operate behind a proxy; at the moment I am setting a repository that I would like to pull from and push from. I want to this using ssh so I don't need the password at work or when I take the laptop at home.
The repository is created.
I have created an additional distinct ssh key and added it in bitbucket setting profile.
I have loaded the ssh key using the following command - ssh-add ~/.ssh/personal
I have checked and the key is loaded.
when I try to connect to my repository,using clone or any other action(push or pull),it doesn't work
operation timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I have also tried to create a config file in .ssh/ with the following values
Host personalid
HostName bitbucket.org
IdentityFile ~/.ssh/personal
but still it doesn't work
I don't know whether is a proxy issue or something else, I thought ssh should allow me to bypass everything.
Can someone give me an idea on how to diagnose the problem?
Thank you
=========
UPDATE: result of the command ssh -Tv hg#bitbucket.org
ssh -Tv hg#bitbucket.org
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/username/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to bitbucket.org [131.103.20.167] port 22.
debug1: connect to address 131.103.20.167 port 22: Operation timed out
debug1: Connecting to bitbucket.org [131.103.20.168] port 22.
debug1: connect to address 131.103.20.168 port 22: Operation timed out
ssh: connect to host bitbucket.org port 22: Operation timed out
=========
If i use port 443
ssh -Tv -p 443 hg#bitbucket.org
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/username/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to bitbucket.org [131.103.20.167] port 443.
debug1: connect to address 131.103.20.167 port 443: Operation timed out
debug1: Connecting to bitbucket.org [131.103.20.168] port 443.
debug1: connect to address 131.103.20.168 port 443: Operation timed out
ssh: connect to host bitbucket.org port 443: Operation timed out
when trying ssh -Tvp443 hg#altssh.bitbucket.or
ssh -Tvp443 hg#altssh.bitbucket.org
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/username/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to altssh.bitbucket.org [131.103.20.174] port 443.
debug1: connect to address 131.103.20.174 port 443: Operation timed out
ssh: connect to host altssh.bitbucket.org port 443: Operation timed out
The best diagnosis would be to fake an SSH session:
ssh -Tv hg#bitbucket.org
(It doesn't matter whether you're using Git or Mercurial; this test does the same thing either way.)
There'll be a wall of output from the command, thanks to the -v, but the first thing to look for would be a line like this at the end with your specific username:
logged in as cpu2007.
That will establish that a) you're reaching Bitbucket and b) your key is added to your account. If you don't see a line like that, then that should help you diagnose your problem.
i'm using minix on my virtualbox, I was able to connect to minix using putty yesterday, but today everything seems to fail. After this failing I tried to uninstall all the openssh and its etc/ssh directory and reinstall, tried other network adapters, tried using cygwin, and using pscp. But I simply can't connect to minix anymore. Any help would be appreciated.
I'm now using this command on cygwin:
$ ssh -p 3022 -v -v -v root#localhost
and the output is:
OpenSSH_6.3, OpenSSL 1.0.1e 11 Feb 2013
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [::1] port 3022.
debug1: connect to address ::1 port 3022: Connection refused
debug1: Connecting to localhost [127.0.0.1] port 3022.
debug1: Connection established.
debug1: identity file /home/Cem/.ssh/id_rsa type -1
debug1: identity file /home/Cem/.ssh/id_rsa-cert type -1
debug1: identity file /home/Cem/.ssh/id_dsa type -1
debug1: identity file /home/Cem/.ssh/id_dsa-cert type -1
debug1: identity file /home/Cem/.ssh/id_ecdsa type -1
debug1: identity file /home/Cem/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.3
ssh_exchange_identification: read: Connection reset by peer
You have to allow connections within your own subnet in the Cygwin /etc/hosts.allow. Add a line like this to your /etc/hosts.allow on the Cygwin machine:
ALL : 192.168.123.0/24 : allow
and in your case, you'll need to add the localhost like so:
ALL : localhost 127.0.0.1/32 [::1]/128 [::ffff:127.0.0.1]/128 : allow
The last line should have come with a stock Cygwin installation so it would be strange if you had to add it.
It matters where you enter it. You will have some DENY entries and you should put it above those, but it should work if you put it with all of the other ALLOW statements.