I created a ssh server in cygwin using the commands:
mkpasswd -l /etc/passwd
mkgroup -l /etc/group
ssh-host-config -y
After that, I'm trying to connect the server but it closes my connection with the following message:
$ ssh cyg_server#localhost
cyg_server#localhost's password:
Last login: Thu Jul 18 16:16:53 2013 from ::1
Connection to localhost closed.
Why it is happening? How do I fix it?
Note: Firewall - off
Thanks =)
Do you have permission to connect in the machine that you've created the server?
Related
I installed RHEL 8.2 with a free developer license (bare hardware), it looks like sshd is installed, running by default with port 22 already open, I did not have to do anything to install sshd or open the port.
[root#<hostname> etc]# systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-08-17 13:35:12 MDT; 1h 7min ago
...
but on Windows 10 Pro (with cygwin ssh client installed),
ssh <user>#<ip-address>
I get this error
ssh: connect to host <ip-address> port 22: Permission denied
On the RHEL 8.2 installation, in a bash terminal, I can successfully ssh locally: ssh <user>#<ip-address> and it works OK.
Any ideas?
This is what I am getting:
From: 192.168.0.153
To: 192.168.0.106
$ssh -Tv <user>#<ip-address>
OpenSSH_8.3p1, OpenSSL 1.1.1f 31 Mar 2020
debug1: Connecting to 192.168.0.106 [192.168.0.106] port 22.
debug1: connect to address 192.168.0.106 port 22: Permission denied
ssh: connect to host 192.168.0.106 port 22: Permission denied
but on 192.168.0.106, it is showing sshd running and port 22 open.
On the machine itself, I can ssh ($ssh <user>#localhost works)
On the server I want to reach, it shows port 22 as open, ssh service enabled (192.168.0.106)
#firewall-cmd --list-all
public (active)
...
interfaces: enp37s0
services: cockpit dhcpv6-client http ssh
ports: 22/tcp
...
First, check the output of ssh -Tv <user>#<ip-address>
It will tell you:
if it can actually contact the server
what local private key it is using
Make sure you have:
generated a public/private key pair in %USERPROFILE%\.ssh, using openSSH ssh-keygen command (ssh-keygen -m PEM -t rsa -P "")
added the content of id_rsa.pub to ~user/.ssh/authorized_keys on the server side.
I had this problem. I had my virtual machine set up for a wired connection. I had to turn on the wired connection in the Red Hat settings. Settings -> Network -> Wired Toggle: ON
Once I turned on the wired connection I was able to make my ssh connections externally.
Vscode insiders stopped to work with remote today morning after (unavoidble) update. It doesn't show remote directory, saying
Connection error: Unauthorized client refused.
and
Failed to connect to the remote extension host server (Error:
Connection error: Unauthorized client refused.)
Deletion of all remote vscode files and killing vscode processes didn't help.
The following transcript can be seen in Output tab:
remote-ssh#0.44.0
linux x64
SSH Resolver called for "ssh-remote+myserver", attempt 1
SSH Resolver called for host: myserver
Setting up SSH remote "myserver"
Using commit id "MYHASH" and quality "insider" for server
Testing ssh with ssh -V
ssh exited with code: 0
Got stderr from ssh: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
Install and start server if needed
> Found existing installation at /home/dimskraft/.vscode-server-insiders/bin/MYHASH...
> Found running server...
>
> *
> * Reminder: You may only use this software with Visual Studio family products,
> * as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
> *
>
> Checking server status with wget
> ==MY-GUID==
"install" terminal command done
Received install output: ==MY-GUID==
Server is listening on port 35693
Spawning tunnel with: "ssh" -L 127.0.0.1:35693:127.0.0.1:35693 -o ConnectTimeout=15 "myserver" bash << 'EOSSH'
echo -e 'Connected to SSH Host - Please do not close this terminal' && sleep infinity
EOSSH
> Connected to SSH Host - Please do not close this terminal
Spawned SSH tunnel between local port 35693 and remote port 35693
Waiting for ssh tunnel to be ready
Tunneling remote port 35693 to local port 35693
Resolved "ssh-remote+myserver" to "127.0.0.1:35693"
------
Downgrading to 1.36.0-insider helped
I have VirtualBox Linux 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux.
I've installed LXD 3.x linux containers I've spun up three instances of ubuntu type containers on them:
+------+---------+----------------------+
| NAME | STATE | IPV4 |
+------+---------+----------------------+
| db1 | RUNNING | 10.81.188.179 (eth0) |
+------+---------+----------------------+
| web1 | RUNNING | 10.81.188.27 (eth0) |
+------+---------+----------------------+
| web2 | RUNNING | 10.81.188.7 (eth0) |
+------+---------+----------------------+
In trying to establish ssh connection to db1 server. I've performed the following setup on the host env :
I've run ssh-keygen which resulted in the following:
~/.ssh/id_rsa
~/.ssh/id_rsa.pub
I have attached to the 'db1' instance like this:
sudo lxc exec db1 /bin/bash
I have then navigated on the db1 box to the /etc/ssh/sshd_config file and I've set the PasswordAuthentication yes parameter, and then I restarted the lxc instance
Back on the host node, I've attempted to copy/set the public key on the remote guest node using the following command:
ssh-copy-id -i ~/id_rsa.pub james#10.81.188.179, and
ssh-copy-id -i ~/id_rsa.pub 10.81.188.179
... both unsuccessful. Here is the log:
james#james-virtualbox:~/.ssh$ ssh-copy-id -i ~/.ssh/id_rsa.pub james#10.81.188.179
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/james/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
james#10.81.188.179: Permission denied (publickey).
Why won't it add that key to the remote db1 machine... ?!
Here is what I did to solve it on my own accord:
1) (Host) Login to guest db1 instance:
sudo lxc exec db1 /bash/bin
2) (Guest) Add new remote user 'james'
adduser james
3) (Guest) Edit /etc/ssh/sshd_config file
PasswordAuthentication yes
4) (Guest) Restart the sshd daemon
systemctl restart sshd
5) (Host) ssh to the guest machine using userid/pwd
ssh james#guest_ip
*** At this point, I had a working userid/password ssh solution, but I wanted to advance past userid/password to the public key authentication solution, so this is what I did next:
6) (Host) Copy public key to the guest machine
ssh-copy-id guest_ip
7) (Host) connect to the guest machine again:
sudo lxc exec db1 /bash/bin
8) (Guest) Remove the password authentication. Edit /etc/ssh/sshd_config file
PasswordAuthentication no
systemctl restart sshd
9) (Host) ssh to the guest system using PKI
ssh gest_ip
*** Success
when i am trying to connect to redis client db using a public key, by use of following command,
ssh -i somekey.pem -v -L 6379 : 127.0.0.1 user#domain.com
when i do so its not connecting and giving the following error
OpenSSH_5.9p1 Debian-5ubuntu1.4, OpenSSL 1.0.1 14 Mar 2012
Bad local forwarding specification '6379'
there is no other redis instance running
what is the issue and what should i do to solve the issue
well i solved this
i did not put port number(6379) after host(127.0.0.1)
following command is working now
ssh -i somekey.pem -v -L 6379:127.0.0.1:6379 user#domain.com
I have setup my gitlab server behind a route, and I have mapped my ssh port to 50000 in the server. the gitlab port is 50001.Then I create a test project and try to clone it in another machine,it's ok when I use http.
git remote add origin http://myrouteaddress:50001/user/test.git
but when I try to test it use ssh, it failed with
git remote add origin ssh://git#myrouteaddress:50000/user/test.git
fatal: The remote end hung up unexpectedly
I have test my ssh setting with
ssh -vT git#myrouteaddress -p 50000
and it passed without problem.
I find out the auth with
sudo tail -f /var/log/auth.log
and get the follow
Jun 1 12:29:22 debian sshd[24799]: Accepted publickey for git from mytestpcip port 37848 ssh2
Jun 1 12:29:22 debian sshd[24799]: pam_unix(sshd:session): session opened for user git by (uid=0)
Jun 1 12:29:22 debian sshd[24801]: Received disconnect from mytestpcip: 11: disconnected by user
Jun 1 12:29:22 debian sshd[24799]: pam_unix(sshd:session): session closed for user git
can someone tell me the reason? Thank you very much!
I finally got the reason, I have generate the ssh rsa key with wrong parameter. the right way is:
ssh-keygen -t rsa -C "email#email.com"
Check your config:
# check gitlab-shell install
sudo -u git -H /home/git/gitlab-shell/bin/check
# check gitlab install
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
Then, try and use the scp syntax:
git#myrouteaddress:50000:user/test.git
or
gitolite:user/test.git
With a config file in your ~/.ssh/config with
Host gitolite
Hostname myrootaddress # or ip address
Port 5000
User git
IdentityFile ~/.ssh/git