LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-09-2011, 07:38 AM   #1
jsaravana87
Member
 
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558
Blog Entries: 5

Rep: Reputation: Disabled
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

Last edited by jsaravana87; 09-09-2011 at 11:28 AM.
 
Old 09-09-2011, 10:17 AM   #2
zackwasa
Member
 
Registered: Sep 2011
Posts: 52

Rep: Reputation: Disabled
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

Last edited by zackwasa; 01-12-2012 at 12:53 AM.
 
Old 09-10-2011, 11:52 AM   #3
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by arun5002 View Post
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.
 
Old 09-10-2011, 01:16 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
...and BTW
Quote:
Originally Posted by zackwasa View Post
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.
 
1 members found this post helpful.
Old 09-12-2011, 03:21 AM   #5
jsaravana87
Member
 
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558

Original Poster
Blog Entries: 5

Rep: Reputation: Disabled
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
 
Old 09-13-2011, 04:57 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by arun5002 View Post
i change the permission to 777
This is real bad...
 
Old 09-16-2011, 12:56 AM   #7
jsaravana87
Member
 
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558

Original Poster
Blog Entries: 5

Rep: Reputation: Disabled
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
 
Old 09-16-2011, 03:37 AM   #8
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to login to server thru console but able to login via network using putty maxy7710 Linux - Newbie 6 03-02-2022 02:42 AM
Putty/SSH login failed when using RSA public key: 'Server refused our key' itsecx@gmail.com Linux - Server 10 10-04-2010 01:19 PM
Putty fatal error: Network error: connection refused (ubunty server 6.06.1) gerardnijboer Ubuntu 2 03-18-2010 03:46 PM
how to set key based authentication in putty to login to remote redhat systems. anil.beni Linux - Newbie 1 11-28-2008 04:24 AM
server refused our key lord-fu Linux - Security 11 11-09-2005 06:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration