Re: Restricting ssh access to selected hosts

From: MafProd (fake@no.where)
Date: 01/08/03


From: MafProd <fake@no.where>
Date: Wed, 08 Jan 2003 00:36:42 +0100

Key identification does work with protocol 2. Make sure you have the latest
OpenSSH and generate a key with keygen -b 2048 -t dsa (SSH2 uses a DSA key
instead of RSA). Then copy the public key to the target box with: scp
~/.ssh/id_dsa.pub user@server: Next log on to the target box and use
cat id_dsa.pub >> ~/.ssh/authorized_keys2 Now you should be able to login
with ssh -2 user@server and it should ask you for the passphrase to
/home/user/.ssh/id_dsa

Succes MafProd.

Michael Siebke wrote:

> In article <86isx0r9gp.fsf@potato.vegetable.org.uk>, Tim Haynes wrote:
>>
>> Michael: ssh-keygen(1) is your fwend(TM). Generate some nice pub/private
>> keypairs putting both parts on the clients and appending only the public
>> bit(s) to ~/.ssh/authorized_keys on the server. The login prompt should
>> change from `User@host's password:' to use the sentence `Passphrase for
>> key' instead.
>>
>> You can make the ssh server key-only, by disabling PasswordAuthentication
>> in /etc/ssh/sshd_config.
>
> Thank your for your answer.
>
> Unfortunately, it won't work, yet. As far as I understood the man page,
> this kind of authorization works only with protocol type 1. I generated
> the key pair with the following command:
>
> ssh-keygen -b 2048 -f morpheus-rsa1.key -t rsa1
>
> Note: for some reasons I use the user account "userA" on the client and
> want to login as "userB" on the server.
>
> As you wrote I've copied both key files to the ~/.ssh directory of the
> calling user:
>
> userA@client $ cp morpheus-rsa1.key /home/userA/.ssh/identity
> userA@client $ cp morpheus-rsa1.key.pub /home/userA/.ssh/identity.pub
>
> The public key was copied to the .ssh directory of the user used for ssh
> login on the server:
>
> userB@server $ cp morpheus-rsa1.key.pub /home/userB/.ssh/authorized_keys
>
> Then I tried to login using the command (as 'userA' on the client):
>
> userA@client $ ssh server -l userB
>
> The server stilled asked for a password. After disabling password
> authentication, I won't allow a login anymore.
>
> May be the following information copied from my sshd_config would help
> to find the problem:
>
> # Part(s) of the /etc/ssh/sshd_config file:
>
> Protocol 1,2
> StrictModes yes
>
> AuthorizedKeysFile .ssh/authorized_keys
>
> AllowUsers userB
> PermitRootLogin no
> VerifyReverseMapping no
>
> PasswordAuthentication no
> PermitEmptyPasswords no
>
> PubkeyAuthentication yes
>
> ChallengeResponseAuthentication no
> PAMAuthenticationViaKbdInt no
> GssapiAuthentication no
> GssapiKeyExchange no
>
> RhostsAuthentication no
> IgnoreRhosts yes
> IgnoreUserKnownHosts yes
> RhostsRSAAuthentication yes
>
> # End of file
>
> Do you see anything which may cause the error?
>
> Ciao, Meph



Relevant Pages

  • Re: Explanation of SSH
    ... I am still unclear on how SSH works exactly. ... Client issues SSH command and names server ... "Shopper" says "server sends back its public host and server keys ... Surely there is only one public key it sends ...
    (comp.security.ssh)
  • Re: Hacker activity?
    ... >login to a server, most as root but some are attempts to login to ... >telnet, all come from the same remote server, and all fail. ... >getting some odd cgi calls to a script on a secure ssl server. ... Make sure root cannot login to your system via ssh. ...
    (freebsd-questions)
  • Public Authentication Problem on Batch Job using SCP2 when SSH Client Reboot
    ... to a SSH server, HOST2. ... for secure ftp login. ... The login ID is a local user account ... we found that scp2 run failed every time the SSH client ...
    (comp.security.ssh)
  • Re: restrict ssh access
    ... > We have one ssh server which receives about 6000 failed attempts to ... > unsuccessful login attempts per client IP address? ... the remote server is also running OpenSSH. ...
    (comp.security.ssh)
  • Explanation of SSH
    ... I am still unclear on how SSH works exactly. ... Client issues SSH command and names server ... "Shopper" says "server sends back its public host and server keys ... Surely there is only one public key it sends ...
    (comp.security.ssh)