83

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 ...


80

You can run this in git bash: 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):


32

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 ...


28

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.


27

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 ...


25

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 ...


22

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/....


21

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:...


20

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....


19

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.


18

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")...


17

Putty does not store keys in an OpenSSH-compatible format. You need to use the "puttygen" tool to manipulate your private key. (via this document, via Google): To change or set a passphrase on an SSH key under PuTTY, do the following: Run the puttygen.exe program. Click on the "Load" button. Select the private key file that you want to put a passphrase ...


17

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 ...


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

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 ...


15

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 ...


15

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: Set to the key's user Permission Entries: Remove all users, groups, and services, except for the key's user Set key's user to Full Control CLI: # Set Variable: Set Key="C:\Path\to\keyfile" ...


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 ...


13

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.


11

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 ...


11

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


10

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 ...


10

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 "...


9

I would add that ~/.ssh/ is readable by your browser if you are using the same user account to run both. Try it! Point your browser to your private key in your home directory. It's fun. So I would recommend storing ssh-keys in the home directory of another user account. a word on passphrase protecting keys These days, cracking non-randomized passwords ...


9

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 ...


9

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 sshd: vi /etc/ssh/sshd_config Under logging uncomment: SyslogFacility AUTH LogLevel INFO Change LogLevel INFO to LogLevel DEBUG Save and exit Restart sshd ...


9

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 to your server. ssh-copy-id does not offer a command line option to choose a key for ...


9

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.


8

The prompt occurs every time because the IP addresses change all the time when using dynamic addressing. Try to use static IP so you only have to add the key only once.


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