[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ssh doesn't work.



On Thu, Dec 08, 2016 at 12:27:53AM +0900, EenyMeenyMinyMoa wrote:
> Thank you for your reply, Andy.
> 
Please be so nice and trim your post to be meaningful and concise. Don't
just slapp something on the top.


> ufw was enabled on the server machine.
> Because I don't have enough knoledge about iptables, I did
> $ sudo ufw allow proto tcp from 192.168.0.3 to any port 9999
> on the server machine.
> Then I successfully connected from the client machine by ssh.
> 
> And next I want to do ssh with authentication key instead of password.
> I've been struggling for hours.
> I rewrited /etc/ssh/sshd_config.
> On the client machine,
> 
> PasswordAuthentication no
> AuthorizedKeysFile    %h/.ssh/authorized_keys
> UsePAM no
> 
> On the server machine,
> 
> PasswordAuthentication no
> AuthorizedKeysFile    %h/.ssh/authorized_keys
> UsePAM no
> 
> Then I tried, but
> Password:
> still appeared.
> 


Please revert to your original configs. Key login works be default and
requires no change.

first generate a key:
ssh-keygen

By default it creats both id_rsa and id_rsa.pub in your ~/.ssh directory.
id_rsa contains the private key and it should remain on the client machine
in your ~/.ssh directory.
Transfer the id_rsa.pub to the server you want to logon to.there append it
to 
cat id_rsa.pub >> <homedirectory of user>/.ssh/authorized_keys

now you should be able to ssh into that server with pk authorization.

If that works you can go on and disable the password authorization by
setting on the server sshd config

PasswordAuthentication no

-H


Reply to: