Ssh Keygen Not Working
- Ssh Authorized_keys Not Working
- Ssh Key Not Working
- Ssh Password Not Working
- Ssh Password Authentication Not Working
I'm using ssh-keygen
to generate a key on Ubuntu 10.10, then using ssh-copy-id
to copy the key to two remote machines that are running 10.04 (one desktop, the other server).
But here's the thing: I can SSH into the desktop without a password, but then some time later I'm asked for a password again. The server always asks for a password and never lets me login with my key.
I've checked permissions on the .ssh
folder, the authorized_keys file
, my id_dsa
and my id_dsa.pub
on all hosts, and they're inline with what the Ubuntu documentation suggests. I've even copied my keys using scp
and gasp set permissions to files and folders to 777 just to rule out any permission issues.
Does anyone have a foolproof way of setting up SSH keys on Ubuntu for password-less SSH access before I change profession and become a flower arranger?
4 Answers
Git Bash is a prompt that is installed for you by msysgit, and is basically the most common Linux command line shell (bash) packaged for Windows to facilitate command line usage of git. Msysgit should also install the ssh-keygen program in a place where it is accessible from Git Bash, but not necessarily from your usual Windows command line prompt. Feb 16, 2012 ssh-keygen for auto ssh login not working I followed the information provided on this page to use ssh-keygen to generate ssh keys to allow me to login to some machines on the local network that would not require me to login (because I'm writing a script that needs to ssh into these machines and execute various commands). Ssh-keygen questions (not working) I managed to ssh between servers. I created and installed public keys for both machines so that I can ssh from both servers to each other (from server A to B and from server B to A). Ssh keygen in unix server.
First of all, I suggest, if you can, to remove+purge, then reinstall openssh-client/server on the three machines, and remove each ~/.ssh, so that you start from a clean situation.
Next, follow this ubuntu wiki page that treats more specifically of ssh keys configuration.
- Then I looked up on the internet and found that I had to generate an ssh key for my account on GitHub. However, upon doing so, when I tried to do ssh-keygen -t rsa 'email@youremail.com' it simply said ssh-keygen is not recognized. I tried doing mkdir C:ssh but that didn't work. If it helps I'm using Ruby Rails and I'm on a Windows computer.
- Ssh-keygen is a tool for creating new authentication key pairs for SSH. Some functionality on this site will not work without cookies and our advertising will be less. Ssh-keygen - Generate a New SSH Key. This page is about the OpenSSH version of `ssh-keygen`. For Tectia SSH, see here. If you wish to generate keys for PuTTY, see PuTTYgen.
Last, keep in mind the following issue: from debian ssh wiki:
Login without password does not work if group or world has write permissions for the home directory on the remote machine.
enzotibenzotibThe operation of ssh is governed by a twisty maze of a couple dozen configuration files spread across ~/.ssh
and /etc/ssh
on both the client and server machines all different.
And the Pluggable Authentication Module (man 7 PAM
) joins in the party for extra kicks.
I will give a nickel to anyone who can explain the precise semantics of all these interacting mechanisms as I've never bothered to spend a day figuring them out.
mswmswInstead of changing the permissions of my home folder, changing the permissions for the ~/.ssh folder solved my problem according to this.
Following is what worked for me on 16.04
Your aim
You want to use Linux and OpenSSH to automate your tasks. Therefore you need an automatic login from host A / user a to Host B / user b. You don't want to enter any passwords, because you want to call ssh from a within a shell script.
How to do it
Ssh Authorized_keys Not Working
First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:
a@A:~> ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/a/.ssh/id_rsa): Created directory '/home/a/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/a/.ssh/id_rsa. Your public key has been saved in /home/a/.ssh/id_rsa.pub. The key fingerprint is: 3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):
a@A:~> ssh b@B mkdir -p .ssh b@B's password: Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time: Audio ground loop isolator schematic.
a@A:~> cat .ssh/id_rsa.pub ssh b@B 'cat >> .ssh/authorized_keys' b@B's password: From now on you can log into B as b from A as a without password:
a@A:~> ssh b@B A note from one of our readers: Depending on your version of SSH you might also have to do the following changes:
Put the public key in .ssh/authorized_keys2 Change the permissions of .ssh to 700 Change the permissions of .ssh/authorized_keys2 to 640
Not the answer you're looking for? Browse other questions tagged ssh or ask your own question.
I want to run a command like:
My understanding is that ssh-keygen outputs to the home directory. I'm working on a networked computer using Git Bash (Windows, MYSS MINGW64) where the home directory is one I don't have access to. I change the home directory like so:
so now when I enter:
it says:
but when I again try to run the ssh-keygen command it runs in the directory that I don't have access to. I've looked through the profile file for some hard coded path but can't find anything. How do I change it to point to a directory that I do have access to?
Ssh Key Not Working
1 Answer
You should be able to do this by specifying the name of the output file with the -f
option, e.g.,
Ssh Password Not Working
Of course, it really helps if the output directory has already been created.
For further reading:
Ssh Password Authentication Not Working
- tutorial (already alluded to, but omitting this informat)
- ssh-keygen -f confusion (create the directory first)
- Linux / Unix ssh-keygen: Create A Host Key File (example of
-f
usage)