quinta-feira, 7 de agosto de 2008

ssh server without auth (no auth server/client)

Well I have a Mac OS and Ubuntu.

My ubuntu have sshd - server.


I didn't want no autentification on ssh server.



Introdution and overview about keygen


if you want no auth in ssh server, you need access on your ssh server to change some configs.
If it is a public server (like hosting servers ) configs on server should be done.

Only need to upload your key.

How to say to ssh server that it's my machine trying login?

Client generate a private and public key. You share public key with server.
private and public key matches by algorithm and it's authentication.

So server recognize the keys and doesn't ask password.



How to do that?

Server

Edit /etc/ssh/sshd_config

Change some configs to:

RSAAuthentication yes
PubkeyAuthentication yes
ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no


Reload server:

sudo /etc/init.d/ssh reload


Client

Gerate key:

ssh-keygen -q -f id_rsa -t rsa



scp ~/.ssh/id_rsa.pub user@server:~/.ssh/id_rsa.pub
ssh user@server
cd .ssh
cat id_rsa.pub>>authorized_keys
rm id_rsa.pub
exit


do same on server if you wish.


AutentificationTroubles?


Put this at server:


server$ chmod go-w ~/
server$ chmod 700 ~/.ssh
server$ chmod 600 ~/.ssh/authorized_keys


Doesn't it works?

cat /var/log/auth.log and grep it!



References:
Troubles page ssh

Sem comentários: