ssh-keygen does not create RSA private key

I faced the same problem recently (after upgrade to mojave 10.14.1), here are 2 possible solutions for this issue. Downgrade your ssh-keygen binary (you can easily get old version from any linux/docker image) OR Add option -m PEM into your ssh-keygen command. For example, you can run ssh-keygen -m PEM -t rsa -b 4096 -C … Read more

How do I make ssh fail rather than prompt for a password if the public-key authentication fails?

For OpenSSH there is BatchMode, which in addition to disabling password prompting, should disable querying for passphrase(s) for keys. BatchMode If set to “yes”, passphrase/password querying will be disabled. This option is useful in scripts and other batch jobs where no user is present to supply the password. The argument must be “yes” or “no”. … Read more

What’s the difference between authorized_keys and authorized_keys2?

In OpenSSH prior to version 3, the sshd man page used to say: The $HOME/.ssh/authorized_keys file lists the RSA keys that are permitted for RSA authentication in SSH protocols 1.3 and 1.5 Similarly, the $HOME/.ssh/authorized_keys2 file lists the DSA and RSA keys that are permitted for public key authentication (PubkeyAuthentication) in SSH protocol 2.0. The … Read more

How to check sshd log?

If no one else is using the system at the moment you could do what i’ve done in such cases: stop sshd service (at least i’ve been able to do this while logged in via ssh) start sshd manually and add some -d options to get more verbose debug output. Unless you have something funky … Read more

ssh-agent forwarding and sudo to another user

As you mentioned, the environment variables are removed by sudo, for security reasons. But fortunately sudo is quite configurable: you can tell it precisely which environment variables you want to keep thanks to the env_keep configuration option in /etc/sudoers. For agent forwarding, you need to keep the SSH_AUTH_SOCK environment variable. To do so, simply edit … Read more

SSH use only my password, Ignore my ssh key, don’t prompt me for a passphrase

Try ssh -o PasswordAuthentication=yes -o PreferredAuthentications=keyboard-interactive,password -o PubkeyAuthentication=no host.example.org In ssh v2, keyboard-interactive is another way to say “password”. The -o PubkeyAuthentication=no option instructs the client not to attempt key pair authentication. In addition, the PasswordAuthentication=yes option is to override any previously configured ssh options that may have disabled it.

“Add correct host key in known_hosts” / multiple ssh host keys per hostname?

get the rsa key of your server, where server_ip is your server’s IP address, such as 192.168.2.1: $ ssh-keyscan -t rsa server_ip Sample response: # server_ip SSH-2.0-OpenSSH_4.3 server_ip ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwH5EXZG… and on the client, copy the entire response line server_ip ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwH5EXZG…, and add this key to the bottom of your ~/.ssh/known_hosts file: server_ip ssh-rsa … Read more