New answers tagged

0 votes

Disable ssh auth by keys

As of today, one more option you may use AuthenticationMethods, please refer https://www.freebsd.org/cgi/man.cgi?sshd_config(5) Please read doc carefully before apply.
  • 2,401
0 votes

Terraform aws_key_pair creates weird key

The solution was to use private_key_openssh instead of private_key_pem in terraform. That produces usable keys for ssh.
  • 21
1 vote

Execute root commands through ssh user

The Problem is: The environment doesnt allow to access the root user directly. If you have a need for it, allowing root user to ssh in isn't the end of the world. For OpenSSH in sshd_config this ...
0 votes

Needing Support Configuring OpenVPN Road Warrior - Locking Down SSH To That VPN

If using legacy IPTables, you may use rule like this: iptables -I INPUT 1 ! -s 10.8.0.0/24 -p tcp --dport 22 -j REJECT With modern NFTables, you have to use something like this one: nft insert rule ...
0 votes

CentOS - SSH Tunneling: How to use another server's network

Depending on your use-case you might have some luck with ssh's -Doption (dynamic tunnelling)? If so, this: serverA:~$ ssh -D 1234 serverB would allow serverA to use its localhost:1234-port as a ...
  • 21
1 vote
Accepted

GatewayPorts permanent connection

You need to keep the SSH connection alive for the tunnel to exist, so if you don't want to run the full PuTTY GUI then you should look at the plink command. It comes from the same developer as PuTTY ...
  • 1,300
0 votes
Accepted

Can I connect to a server at home from a laptop via a VPN running on a remote VPS?

Yes you can install VPN on a VPS and use that to connect to your home network. The architecture for this kind of VPN is called hub-and-spoke and can be done easily with WireGuard. The setup on server ...
0 votes

Ensure a user can only SSH to the port they have been designated

I would not recommend designating a port for a user. A port is mapped to a service. Usually a user is mapped to a home directory and a group which is attached to a ACL, to ensure the user has ...
  • 417
1 vote

How so I SSH to two different machines with the same IP?

SSH checks its known_hosts for all entries for this host. If all of them don't match, including the usual case of all being the single one entry, then SSH will complain. If any of them matches SSH ...
  • 9,106
1 vote

How so I SSH to two different machines with the same IP?

You don't identify the OS of the development machine but this should work for openSSH on either Linux or Mac. From the command line ssh -o StrictHostKeyChecking=no 10.0.4.4 Or set up ~/.ssh/config ...
  • 571
0 votes

Non-interactive SSH connection fails - error: can't open /dev/tty: No such device or address; Host key verification failed

... debug1: Server host key: ECDSA debug1: read_passphrase: can't open /dev/tty: No such device or address I came to this issue (10 years in the future) and found that the issue is not the tty or ...
  • 121
0 votes

Specify SSH Key to use by server IP

either use -i option as in ssh -i ~/.ssh/my_other_key 1.2.3.4 or use IdentityFile in config, correct syntax is Host 1.2.3.4 IdentityFile=~/.ssh/my_other_key note the indentation in lines after ...
  • 1,341
3 votes

Execute root commands through ssh user

... connect to the unpriviliged user first by ssh-key, then su to the sudo priviliged user and then sudo -i/sudo su to the root account and execute the commands. The whole point of sudo is to ...
  • 1,366
0 votes

ssh tunnel for https SOAP web service

We had the same problem and ended up using sshuttle. The flow is as follows: Lookup the IP of the service, eg. using nslookup Start sshuttle -r username@middle_host SERVICE_HOST_IP
  • 101
0 votes

How to check if an RSA public / private key pair match

This is a very old thread, but I found the answers a little bit overengineered. So I just created yet another oneliner :) [[ `ssh-keygen -yf /path/to/private_key_file` == `cat /path/to/public_key_file`...
  • 101
0 votes

OpenSSH - sshd_config - Allow sftp-chroot AND normal ssh login with same user

I was also confused by this problem, when I setup chroot sftp for users they cannot login by ssh. My scenario is slight different, I need to provide a limited shell environment for users, whilst users ...
-1 votes

How does systemd put sshd processes in slices?

For the avoidance of doubt: make sure you are using OpenSSH and sshd has UsePAM=yes. This is the default on e.g. Debian, but is not the OpenSSH upstream default. Without UsePAM=yes, libpam_systemd.so ...
0 votes

Blocking SSH access from WAN side of CISCO 890 to management plane

I think i've just got it (partially). In case this helps anyone also ripping their hair out over this. So I had a vlan1 configured with: ! interface Vlan1 description InternalNetwork ip ...
  • 121
0 votes

Bash: Checking if can sudo on remote host using sshpass; how 'exposed' is the password?

try to run sshpass at local (for remote sudo), but failed 1. test sudo without ssh //ok $ SSHPASS=your_passwd sshpass -e sudo id uid=0(root) gid=0(root) groups=0(root) sudo with ssh //fail SSHPASS=...
  • 163
0 votes
Accepted

Is it possible to confine SSH users to a new mount namespace on Login?

Turns out this is extremely easy, especially for /var/tmp. On RHEL-derived systems such as CentOS 7, this can be achieved by simply uncommenting a line in /etc/security/namespace.conf: # /etc/security/...
  • 1,731
1 vote

Unable to access server using ssh after setting a static ip in alpine Linux

The netmask in the ip config output is still a /24 subnetmask. Please verify that. Maybe you need to reboot. Please check the routing as well ip route
0 votes

SCP between 2 remote servers with local key

I have found a partial solution where the key is forwarded. This involves adding ForwardAgent yes to my local .ssh/config for the server1 definition, then modifying the command to use the username and ...
-2 votes

ssh-keygen unable to verify key "unknown option -- Y"

For ssh from windows, execute this command in cmd (opened as administrative): notepad ~/.ssh/ after that, enter tab to complete like: notepad C:\Users\User\.ssh\known_hosts In the opened notepad ...
1 vote
Accepted

ssh-keygen unable to verify key "unknown option -- Y"

Your version of OpenSSH is too old. Debian 10 appears to have version 7.9p1, but the -Y argument to ssh-keygen (and support for signing and verification in general) didn't show up until version 8.0p1. ...
  • 41.4k
0 votes

What causes SSH error: kex_exchange_identification: Connection closed by remote host?

Some other reasons are : If your Web Server / App Server listen on different port this issue also happen. Also you we need to check the Client System firewall for it , If the outbound connection is ...
0 votes

Google Compute Engine ssh: connect to host <IP> port 22: Operation timed out

Go to edit your VM. Go to section Automation Add Startup script #!/bin/bash sudo ufw allow ssh Stop and Start VM.
0 votes

private github repo in package.json breaking azure website deployment

Maybe it's too late, but it's looking for the url of your repository from which you want to recover your site, "git+ssh://git@github.com:username/nameofrepo.git where you put "git+ssh://git@...
0 votes

"debug1: read_passphrase: can't open /dev/tty: No such device or address" when trying to connect through SSH

What worked for me on a Docker image running node:11-alpine was to modify the SSH config, stripping password auth echo 'PasswordAuthentication no' >> /etc/ssh/ssh_config You should also be able ...
  • 2,025
0 votes

Can't SSH to Amazon Lightsail server using browser-based client

I had a similar problem after creating an Ubuntu 20 Lightsail VM then doing an in-place upgrade to Ubuntu 22 (via sudo do-release-upgrade). Luckily I added my own public key to the ubuntu user's ...
  • 1
0 votes

How To Disable diffie-hellman-group1-sha1 for SSH

Step 1: To list out openssh client supported Key Exchange Algorithms algorithms # ssh -Q kex Step 2: To list out openssh server supported Key Exchange Algorithms algorithms # sshd -T | grep kex Step ...
0 votes

How to enable legacy ciphers in modern SSH client

I found my own answer thanks to this: How can I use a legacy ssh-rsa key on CentOS 9 Stream? And this: ssh failed on almaLinux 9 with openssl 3.0.1 (error in libcrypto) #18420 The solution for me is ...
0 votes

Ansible 'ping' fail - 'session request sent', but 'read header failed: Broken pipe'

According the output provided it seems that you try to establish a SSH connection to a switch. Such devices may not have all capabilities for Python scripts. Because of ping module – Try to connect to ...
  • 607
0 votes

pam radius bypass same local user (exception user)

#%PAM-1.0 auth required pam_radius_auth.so #auth required pam_sepermit.so #auth substack password-auth #auth include postlogin Used with polkit to reauthorize users in ...
0 votes

Cannot login via SSH anymore [RHEL7]

GOT IT! Someone have changed some security OS files: /etc/pam.d/sshd and /etc/pam.d/system-auth, in wrong way. I restored the original file and did: authconfig --updateall Now I'm able again to login ...
  • 101
0 votes

Openstack ubuntuVM SSH public key Permission denied on first boot

I faced this issue on the Ussuri on Microstack. I tried the suggested approach of 'hard boot' but got the same error. I also got the same error with Fedora 36 image. I resolved the error but disabling ...
  • 1
0 votes

Can't add password to new ssh server host (Permission denied, please try again.)

I would suggest please go through all sub and same level pages of windows ssh https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview . I guess issue is you are trying ...
  • 2,401
0 votes

GCP - "Transferring SSH keys to the VM" - constant loop

Try apt install google-guest-agent google-compute-engine, following the recommendation on this page. The same problem happened to me last night on one of my GCE instances. I usually use ansible to ...
  • 101
0 votes

Can't add password to new ssh server host (Permission denied, please try again.)

There is no such instructons cointaining ssh clie@127.2.0.1 from provided link https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse?tabs=gui Check you ...
  • 726

Top 50 recent answers are included