I've set OpenSSH server with private/public keys, with password login disabled.
I was wondering if there was a way to not even show the 'login:' prompt when someone without a key tries to connect.
EDIT
Okay ... There seems to be some confusion as to what I'm trying to achieve. So, here's a better explanation (I hope) ...
Current setup
Client with key connects, and goes through the process:
login as: username
BANNER
Authenticating with public key "Key name"
Passphrase for key "key name": *******
Welcome
username@hostname:~$
Client without key connects, and goes through process:
login as: username
BANNER
Server refused our key
What I want
client without key connects, and goes through process:
No key, go away.
On the server side, edit
/etc/ssh/sshd_config
so that you have the line:then restart the server:
That will remove the ability to authenticate without a key.
However, you will always have to identify yourself, so you can't remove the login prompt.
If you use
ssh username@hostname
to connect, you'll never see it, but others will if they connect to the hostname with no username.You can limit access to only your username with a key if you add to the above:
For this and other things, see the Ubuntu wiki page for SSH.