LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Server Refused our key error:while login putty (https://www.linuxquestions.org/questions/linux-server-73/server-refused-our-key-error-while-login-putty-902117/)

jsaravana87 09-09-2011 07:38 AM

Server Refused our key error:while login putty
 
Hi,

By using putty generator I generate a publicssh key and privatessh key and i copied and pasted the created publickey in the directory .ssh,while configured privatekey in putty terminal in client while im login in using private key im facing following error

default i had authorized_keys in .ssh/authorized_keys i faced lots problem so i changed the path as below

I also enabled
i followed the folowing step
1. Created a folder for public SSH keys
mkdir /etc/publicSSHkeys
2. Moved the authorized_keys file there
mv ~/.ssh/authorized_keys /etc/publicSSHkeys/
3. Modified sshd_config to the new location, change this…to
AuthorizedKeysFile .ssh/authorized_keys
to this:
AuthorizedKeysFile /etc/publicSSHkeys/authorized_keys
4. Then i just need to start the server
service sshd start
5. You’ll still need to make sure your public key is in /etc/publicSSHkeys/authorized_keys, and your SSH client (in my case Putty) is loading your private key.

chmod -R 777 /etc/publicSSHkeys

i can some pin point my problem where im making mistake ..

loginas:root
server refused our key
Access denied
root@xx.xx.xx.'s password:

i followed the below link for configuration
http://linux-sxs.org/networking/openssh.putty.html
Regards
arun

zackwasa 09-09-2011 10:17 AM

the public key should be placed in:
/root/.ssh/authorized_keys (if it's a rsa key)
/root/.ssh/authorized_keys2 (if it's a dsa key)

The .ssh folder and all its files needs to be owned by root and have 600 permissions

check the /var/log/secure or /var/log/auth.log for errors when you login in and the key is refused

RMI

Reuti 09-10-2011 11:52 AM

Quote:

Originally Posted by arun5002 (Post 4467222)
Hi,

By using putty generator I generate a publicssh key and privatessh key and i copied and pasted the created publickey in the directory .ssh,while configured privatekey in putty terminal in client while im login in using private key im facing following error

default i had authorized_keys in .ssh/authorized_keys i faced lots problem so i changed the path as below

I also enabled
i followed the folowing step
1. Created a folder for public SSH keys
mkdir /etc/publicSSHkeys
2. Moved the authorized_keys file there
mv ~/.ssh/authorized_keys /etc/publicSSHkeys/
3. Modified sshd_config to the new location, change this…to
AuthorizedKeysFile .ssh/authorized_keys
to this:
AuthorizedKeysFile /etc/publicSSHkeys/authorized_keys
4. Then i just need to start the server
service sshd start
5. You’ll still need to make sure your public key is in /etc/publicSSHkeys/authorized_keys, and your SSH client (in my case Putty) is loading your private key.

chmod -R 777 /etc/publicSSHkeys

i can some pin point my problem where im making mistake ..

loginas:root
server refused our key
Access denied
root@xx.xx.xx.'s password:

i followed the below link for configuration
http://linux-sxs.org/networking/openssh.putty.html
Regards
arun

The steps you listed are not the ones in the link you posted. So I’m confused about the combination, and why you want to put them in /etc? Just put the one-line public part of the key-pair into ~/.ssh/authorized_keys and you are done.

Pitfalls: Your home directory may not be writable by anyone but yourself. The ~/.ssh may not be readable by anyone except yourself.

unSpawn 09-10-2011 01:16 PM

...and BTW
Quote:

Originally Posted by zackwasa (Post 4467399)
the public key should be placed in:
/root/.ssh/

the key should not be in /root/.ssh as root should not log in over the network using any service anyway.

jsaravana87 09-12-2011 03:21 AM

Hi

Thanks for ur reply isolved out prolem by changing the authorizqd key to path

vi.ssh/authorizedkeys

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAg2CZvrXsoEEaFKcrQrCllxtnxAMqcJWMMgya0udXGpHJwqjDXMq1J+5LXB2zw/ZbplHx5gwyPDzszwTsAWGF7j4oykkmX/I1ayyjoJ+prwp4XzbpJ152DJ2QZhyEiMFUxFxjKNyTgdhDd3igkM1/NpZwhFmvcQXL95pWX8fjUj8= ssh-rsa 15245

i does int removed out the extension ssh-rsa 15245 while pasting into authorizedkeys extension file and i change the permission to 777 to authorisedkey now my error got resolved thanks for everyone huhad replied to my post

Regards
arun

unSpawn 09-13-2011 04:57 PM

Quote:

Originally Posted by arun5002 (Post 4469514)
i change the permission to 777

This is real bad...

jsaravana87 09-16-2011 12:56 AM

password generator using putty
 
Hi
in ubuntu 10.04 u can find itt by default but centos u have to add %h before /.ssh/authorized_keys
for multi user login by using ssh key generator


AuthorizedKeysFile %h/.ssh/authorized_keys

Reuti 09-16-2011 03:37 AM

The explanation is in man sshd_config about this parameter, and it ends with:
Quote:

[...] %h is replaced by the home directory of the user [...] After expansion, AuthorizedKeysFile is taken to be an absolute path or one relative to the user's home directory. The default is “.ssh/authorized_keys”.
So, specifying it this way or not at all makes no difference AFAICS.


All times are GMT -5. The time now is 08:51 AM.