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. I want to run a command like: ssh-keygen -t rsa -b 4096 -C '[email protected]' My understanding is that ssh-keygen outputs to the home directory. I'm working on a networked computer using Gi. 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. The directory /.ssh MUST be owned by the user, not root. So change that and it will work. To avoid having to type the passphrase for your private key every time you use ssh-agent. Ssh-add.ssh/idrsa will add the key to the agent, from then on the agent will provide the key to ssh.
Active1 year, 10 months ago
This question already has an answer here:
- ssh no longer allows public key authentication 9 answers
I'm having trouble setting up public key authentication for an SSH server on Ubuntu Server 12.04 (A) for authentication from an Ubuntu Server 13.04 (B).
What I'm doing now (I'm trying to follow the instructions here):
- On B: Create a new key with
ssh-keygen -C '
, using no passphrase, writing to/.ssh/id_rsa
- I don't get any errors - On B: Run
ssh-copy-id -i /.ssh/id_rsa user@host-a
- also, a success message - On B:
ssh -i /.ssh/id_rsa user@host-a
- I still have to enter my password foruser@host-a
On A, I checked if the
/.ssh/authorized_keys
is modified after running ssh-copy-id
, and this is the case. Also, on both devices I added this to /etc/ssh/sshd_config
:Does anyone know what might be the problem here?
Here's the tail of my
dessert/var/log/auth.log
on machine A:29.3k7 gold badges88 silver badges121 bronze badges
user125111
marked as duplicate by Ciro Santilli 新疆改造中心法轮功六四事件, Eric Carvalho, karel, Yaron, Charles GreenSep 14 '17 at 14:05
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
5 Answers
Anything in log files, particularly
/var/log/auth.log
? You might also double-check permissions on the .ssh directory and files. I haven't had to modify sshd_config for this kind of access, myself. I am wondering if your modification broke things, especially the AuthorizedKeysFile line.Typically, you would want to put the authorized_keys under
$USER/.ssh
. Here are the permission from a user on one of my servers:
Make sure the individual files are at least this restricted.
As guntbert points out, also check that the directory and files are owned by you. The permissions won't make sense (or work) otherwise.
Who owns the keys in authorized_keys on B? (The bit that says user@host after the key.) Is it root@A ?
That is, in looking at
~/.ssh/authorized_keys
, what is the equivalent of bert@etherbert
for your set-up: I would just edit the remote .ssh/authorized keys manually for testing, putting in the id_rsa.pub contents of the user you are intiating the connection with.
Make sure you are coming from the user that has the key in the remote authorized_keys file.
belacquabelacqua16.5k15 gold badges75 silver badges104 bronze badges
The directory
~/.ssh
MUST be owned by the user, not root. So change that and it will work.To avoid having to type the passphrase for your private key every time you use ssh-agent.
guntbertguntbertssh-add .ssh/id_rsa
will add the key to the agent, from then on the agent will provide the key to ssh.9,93813 gold badges32 silver badges74 bronze badges
Besides all the other guys had provided the solutions, my additional suggestion is you should first check the logging file:
/var/log/secure
, which is where sshd puts logs in. If something goes wrong, checking what sshd has complained in /var/log/secure
will quickly narrow down the possible issues. MeowMeow
This is an old question and already answered, but if the user has the home directory encrypted (using
ecryptfs
or some such), ssh daemon will not be able to see the ~/.ssh/authorized_keys file. If that is the case follow the solution listed here. This solution recommends changing sshd configuration (/etc/ssh/sshd_config) and changing
AuthorizedKeysFile
to /etc/ssh/%u/authorized_keys
and copying your authorized_keys file to /etc/ssh/username
/authorized_keys file (along with proper ownership for /etc/ssh/username
and proper permissions as required by sshd).journeyerjourneyer
Nothing worked for me. I don't know why ? I tried each solution.
First
Ssh Key Not Working
ssh-copy-id : did not copy id_rsa & id_rsa.pub
Second
ssh-agent $SHELL
ssh-add -L
ssh-add
In Pennsylvania, the PA Department of Transportation (PennDOT) is the umbrella agency in charge of all things DMV-related, but depending on what task you need to complete, you'll have to look for specific offices in Pennsylvania. Find your closest Pennsylvania driver license center to take care of tasks related to: Driving permits.
ssh-copy-id -i remote-host
Both did not work. I guess I am unlucky. Someone was saying to change the permission of
.ssh
folder from root. I thought that'd be not a better option. What I was doing when my above case failed. I created a new key on server and save this key on github / gitlab. That's also not a cool way. Here I tried an alternate, I hope it may help someone.Photoshop 7.0 serial key free. Download Setup File Adobe Photoshop 7.0 Serial Key + Latest VersionAdobe Photoshop 7.0 Serial key comprehensive tools to draw your desired sketch lines and shades easily.
First I create a folder on remote server with that user permission who can write into it. Then I follow below steps on my local machine
cd ~/.ssh
scp -r * [email protected].**:path_to_writable_folder_on_remote_server
And then I logged in on remote server and then
cd path_to_that_folder_where_I_copied_keys
Ssh Key Asking For Password
& Then
mv * ~/.ssh
Ssh Keys Not Working Gitlab
(whew) Finally, it worked.
VineetVineet