LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-07-2012, 10:57 AM   #1
coelhoapm
LQ Newbie
 
Registered: Oct 2012
Posts: 3

Rep: Reputation: Disabled
SSH keys not working


Hi all,

I have 3 servers with the same configuration using CentOS 6.3, and they all have a common user called user1.

For each server i have created a pair of ssh keys using the command:
ssh-keygen -t rsa
(all fields were left blank)

And after this i have copied the contents of each id_rsa.pub to each others authorized_keys2 file.

All good so far, but everytime i try to connect between servers it keeps asking me the user1 password.

Any thoughts?

Thanks
 
Old 11-07-2012, 04:10 PM   #2
larvel
LQ Newbie
 
Registered: Jun 2012
Posts: 29

Rep: Reputation: Disabled
See secure log. Try disabling selinux. Setenforce 0. Maybe too wide permissions on the ssh folder or keys
 
Old 11-07-2012, 07:51 PM   #3
ph0rty
LQ Newbie
 
Registered: Sep 2012
Distribution: OpenSUSE, CentOS, RHEL
Posts: 8

Rep: Reputation: Disabled
Wink SSH keys & Permissions

Hi,
The most common issue when copying keys manually to hosts are file permissions.
the .ssh directory should be owned by the user, and have permissions 700 or u=rwx (ls -la ~ | grep ssh should give you a: drwx------)
files contained within the .ssh directory should be set as:
id_rsa - 400 or 600
id_rsa.pub - 600
known_hosts - 600 or 640

*late addition (thanks linosaurusroot)
and of course your public key entry in the authorized_keys or authorized_keys2 file (i just hardlink the 2)
with permissions 600.

if your key files (private) are readable/writable by anyone else (including group membership) then openssh will deny the use of the keys.
in future, use the ssh-copyid command to upload the files, it will set the correct permissions for you automatically.
Hope that solves your issue.

Last edited by ph0rty; 11-07-2012 at 10:53 PM. Reason: addition of details
 
Old 11-07-2012, 10:12 PM   #4
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
authorized_keys2- Y U not use authorized_keys ?
 
  


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
ssh public keys not working war1025 Debian 2 06-21-2009 09:31 PM
SSH keys suddenly not working GaijinPunch Linux - Networking 8 03-01-2008 06:38 PM
ssh using keys not working deadlock Linux - Newbie 4 01-11-2008 03:37 AM
ssh using keys not working deadlock Linux - Newbie 1 01-10-2008 08:41 AM
SSH keys not working GATTACA Linux - Server 8 07-10-2007 10:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:19 AM.

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