103

You can run this in git bash, Windows WLS or bash on real GNU/Linux. eval `ssh-agent -s` ssh-add ~/.ssh/*_rsa it will ask for pass phrase in the second command, and that's it. Each additional action you will need to do (which once required pass phrase) won't ask you for the pass phrase (see an example in the screen shot below):


101

In my case ssh-keygen -R ... didn't fix the warning. I had extra information like this: Offending key for IP in /home/myuser/.ssh/known_hosts:8 Matching host key in /home/myuser/.ssh/known_hosts:24 I simply manually edited ~/.ssh/known_hosts and deleted line 8 (the "offending key"). I tried reconnecting, the host was permanently added, and everything was ...


48

Deploy Keys to the rescue A deploy key is an SSH key that : is stored on your server and grants access to a single GitHub repository. Often used to clone repositories during deploys or continuous integration runs. Deploys sometimes involve merging branches and pushing code, so deploy keys have always allowed both read and write access. But Because write ...


46

This will usually resolve most SSH authorized key permission issues on the server side, assuming someone didn't make additional changes to the permissions. sudo chown yourusername:yourusername /home/yourusername/ -R sudo chmod o-rwx /home/yourusername/ -R If your admin created the .ssh/ directory or .ssh/authorized_keys file as root (which is most commonly ...


38

One option you could consider would be to user the .ssh/config file. Example: .ssh/config Host server.com HostName server.com User serveruser IdentityFile /Users/myuser/.ssh/mykey By doing this you could execute "ssh server.com". The config file would use the specified Username and Identity File.


31

In macOS, you need to generate your public and private keys from the Terminal. If you haven't yet done this, the .ssh directory will not exist. To create them: Open the terminal App and enter the following command: ssh-keygen You'll get a prompt to choose the location for the keys. It will say “Enter file in which to save the key (/Users/your-username/.ssh/...


29

A slightly better and permanent solution is to auto launch the ssh-agent when opening the git bash on windows. You can copy/paste the below in your .profile or .bashrc. I prefer to put it on the .profile env=~/.ssh/agent.env agent_load_env () { test -f "$env" && . "$env" >| /dev/null ; } agent_start () { (umask 077; ssh-agent >| "$env")...


26

Yes, the option is equivalent, however, it doesn't forward keys in general – it forwards connections to the "SSH agent" specifically. The "agent" holds your keys in memory, decrypted (so you only need to unlock them once), and the client asks it to sign data for authentication. On Linux/Unix/BSD/Cygwin, OpenSSH's agent program is ssh-agent (though in some ...


24

The only command you need to run is chmod 600 ~/.ssh/id_rsa. That's it. This changes the permissions on the file so that the owner (you) can read and write it, which will remove the error message you receive.


24

Keys must only be accessible to the user they're intended for and no other account, service, or group. GUI: [File] Properties → Security → Advanced Owner: The key's user Permission Entries: Remove all except for the key's user Set key's user to Full Control Cmd: ::# Set Key File Variable: Set Key="%UserProfile%\.ssh\id_rsa" ::# Remove ...


23

I do lots of ssh-ing around between my LAN computers and my two webhosting accounts, so I've sorted out all kinds of odds and ends with SSH, including authentication problems using ssh -v to see where and what went wrong. Having just resolved this issue and not being happy with the answers, I wanted to really know "why" myself... The trigger for my case is:...


22

Although none of the other answers directly fixed it, I took some of their methods and combined them. This is what worked for me on my Synology DS414slim, running DSM 6.1. I logged in as admin and executed the following command (no need to fill in your username, it will work as-is): This will set your home directory to 700 permission, owned by [you]:users....


20

If the private SSH key already exists, this can be done from within FileZilla, without the need to install extra software. Simply go to menu Edit → Settings → Connection → FTP → SFTP. Click button Add key file and add your private key there. It will convert the key for you.


20

What I am going to do is create an account X on my local computer. Login as account X, then ssh-keygen for account X. No, what you're going to do is rather useless. The server doesn't know anything about your local account name (like it used to in the rsh days); the ssh client merely uses it as the default login name it'll try, and the ssh-keygen tool ...


20

I had the exact same problem on two servers: a Linux running Debian stretch and on a NAS (Synology DS715) it turned out that in both cases, the home directory permissions on the server were wrong the auth.log on the server was very helpful Authentication refused: bad ownership or modes for directory /home/cyril on the Linux, it had the write/group bit on ...


19

The ssh-copy-id command from OpenSSH fails if there is no private key file with the same name available, because it tries to login with the specified key to check if it is already present on the remote server. In recent versions you can override this behavior with the -f switch ("Forced mode"). From the man page: -f Forced mode: doesn't check if ...


17

When using CentOS 7, and I'm confident applies to other Linux OS's using sshd as well. With root access, you can determine more about why authentication may be failing. To do this: Enable logging for the sshd daemon: sudo vi /etc/ssh/sshd_config Under logging uncomment: SyslogFacility AUTH LogLevel INFO Change LogLevel from INFO to DEBUG Save and exit ...


16

First you need get public key in a format for OpenSSH authorized_keys file. In WinSCP 5.15, you can use Display Public key on SSH > Authentication page of Advanced Site Settings dialog: Or you can use PuTTYgen - It's a part of PuTTY package, but WinSCP comes with its own copy (use Tools > Run PuTTYgen on WinSCP Login dialog). Start PuTTYgen. Load your ...


16

A Host line can have more than one pattern. And it's not really spelled out in the documentation, but a "!" (exclamation) at the beginning of a pattern means "if a host matches this pattern, then don't apply the section". In other words, you can do this: Host * !special1 !special2 IdentityFile etc... And it should match any host except "special1" and "...


16

Github organizations can "sort of" support this work-flow: Create an organization Create a dummy account which will be used for readonly access Add the dummy account to the organization with read-only permissions Add whatever SSH keys you want to have on the read-only account Use your normal account(s) to allow writing


16

In recent versions of ssh-keygen, one gets an RSA public key fingerprint on Unix-based systems with something like: $ ssh-keygen -l -E md5 -f ~/.ssh/id_rsa.pub where the path refers to a public key file.


15

Quoting OpenSSH 7.7 man page of ssh-keygen: -o Causes ssh-keygen to save private keys using the new OpenSSH format rather than the more compatible PEM format. The new format has increased resistance to brute-force password cracking but is not supported by versions of OpenSSH prior to 6.5. Ed25519 keys always use the new private key format. The option ...


14

The problem was that after the cygwin update I had OpenSSH v7 and it no longer thought that my old SSH key was secure enough. You can read in the debug info above that it’s a ssh-dss key. The simple fix was to add this PubkeyAcceptedKeyTypes ssh-dss to ~/.ssh/config The better solution would of course be to generate a new secure key-pair.


14

You either follow that procedure for multiple machines or copy the private key. Depending on your personal security requirements and workflow one might be easier or "better" than the other. If your private key is compromised you would need to remove it from the authorized_keys file and/or revoke it. In addition, depending on your workflow, you would need to ...


12

0644 in not supposed to be too open for a public key, but is too open for your private key. Your private key should have permission 0600 while your public key have permission 0644. By the way, you should also take care of the permission on .ssh folder. It should has the permission 0700, so that only you, the owner, has control over the folder. As to your ...


12

There is a very nice tool named KeePass2 (http://keepass.info/) with the extension (http://lechnology.com/software/keeagent/) You can store there Passwords, SSH Keys, and a lot more(on the official KeePass page are a lot more usefull extensions) If you want to login automaticaly with your SSH Keys, you just need to install PuTTY, Pageant and KeePass with ...


12

You may be running ssh-keygen on the wrong file. ssh-keygen -y operates on a private key file. ".pub" files normally contain the public key. You probably have a file there named my_key, without any extension, and it ought to be mode 0600. That is the file which should contain the private key. To directly answer your question, SSH keys are normally used to ...


12

Your ssh server is providing sha256 public key hashes, which is far more secure than md5 hashes. You then have to specify to ssh-keygen that you want sha256 instead of md5 hashes. Try executing the command on your home-machine: for pubkey_file in /etc/ssh/*.pub; do ssh-keygen -lf ${pubkey_file} -E sha256; done


11

The file extension is often either random or not enough to identify the format. Broad categories: PEM files with ASN.1 data, encoded with DER PEM files with data encoded in some other format Non-PEM formats PEM files wrap Base64 between -----BEGIN----- and -----END----- "tags". They are also commonly used to contain both private key and SSL ...


10

ssh-copy-id appends keys to the remote authorized_keys file. To add several specific keys, run it once per key with -I <key-file-name>. Update After your comment, I think I got your question wrong. You want to use one key to authenticate while installing another on your server. ssh-copy-id does not offer a command-line option to choose a key for ...


Only top voted, non community-wiki answers of a minimum length are eligible