LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   ssh using public key (https://www.linuxquestions.org/questions/linux-networking-3/ssh-using-public-key-319941/)

jkmartha 05-04-2005 02:36 AM

ssh using public key
 
fedora core - 2

i want to login to a remote server thru ssh using public key authentication. The remote server is on suse. suppose the username on the remote box is "user1" .
# ssh-keygen -t dsa -b 2048
i created one user with same username "user1" in my box.
i used the above command & placed the private key file in /home/user1/.ssh in my machine & placed the public key file in /home/user1/.ssh in remote machine.

now i try to login using
# ssh user1@x.x.x.x where x.x.x.x is the IP add of the remote box.
the reply is
permission denied : public key
Can anyone guide me ????

pevelius 05-04-2005 02:52 AM

(copied from security forum, ssh login attempts thread)

put your private key into the remote system in a file called authorized_keys.

1) Check if you have a .ssh directory
ssh user@remotehost 'ls -l .ssh'

2) If not:
ssh user@remotehost 'mkdir .ssh'

3) Copy your public key
scp $HOME/.ssh/id_rsa.pub user@remotehost:.ssh/authorized_keys

NOTE: if the .ssh directory and the authorized_keys file already exist and the remote system / account are shared or you access user@remotehost from more than one machine then do the following:

scp $HOME/.ssh/id_rsa.pub user@remotehost:.

then

ssh user@remobehost 'cat id_rsa.pub >> .ssh/authoized_keys' to append to rather than overwrite the authorized_keys file.

thatīs what i used. also the authorized_keys-file is configured in sshd config file. adjust your config accordingly.


All times are GMT -5. The time now is 12:15 PM.