LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-13-2008, 07:45 AM   #1
tungvs
Member
 
Registered: May 2008
Distribution: Centos; Ubuntu; Fedora
Posts: 98

Rep: Reputation: 15
Weird things of SSH


I'm using openSSH in RHEL 4. Just my exercise. But I found something weird about the behavior of the SSH. The circumstances: I have 2 computer: com1 and com2. Each computer has an user account (user1@com1 and user2@com2). I intend to make user1@com1 ssh to user2@com2 without prompting a password, so sharing public key is required.
- Method 1: using
Code:
scp user1@com1:.ssh/id_dsa.pub user2@com2:.ssh/authorized_keys
This one works perfectly.
- Method 2:
Code:
scp user1@com1:.ssh/id_dsa.pub user2@com2:.ssh/something.pub
then in com2:
Code:
cat .ssh/something.pub > .ssh/authorized_keys
This one doesn't work until I make one more
Code:
chmod 600 .ssh/authorized_keys
- Method 3: First steps are exactly those in method 2. Then I change to root account
Code:
su
. With the root, I
Code:
cat .ssh/something.pub > .ssh/authorized_keys
. This one works without having to "chmod"

So, the question is, what makes the differences between the methods ? Why do we need "chmod" to make the thing works ? ( I think the "chmod" here does not relate to permissions at all because I changed to the same permission ! )

PS: Excuse me if my English is so bad .

Last edited by tungvs; 06-13-2008 at 07:48 AM.
 
Old 06-13-2008, 08:19 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
The root user and normal users usually have a different permissions mask. Can you repeat what you did and make sure you note the owner/group and permissions of those files as you go along?

It's been a while since I've read through the OpenSSH and OpenSSL code, but they do care about permissions. For example, they will not work if a private key file had 'r' permission for anyone other than the owner. I imagine they might also refuse to work if anyone had write permission for the 'known_hosts' file - after all, that would mean someone can create and change your 'known_hosts' file to make themselves a trusted entity (which you probably don't want to happen).
 
Old 06-13-2008, 08:55 AM   #3
tungvs
Member
 
Registered: May 2008
Distribution: Centos; Ubuntu; Fedora
Posts: 98

Original Poster
Rep: Reputation: 15
Thank you, Pin. It's exactly the matter. I've checked the permission of the authorized_keys file and it's 660. The umask for user2 is 002. When I change the umask of user2 to 022, the problem is solved. The root@com2 has umask of 022 in the directory, so using root account to make authorized_keys file is acceptable . "chmod 600" is the thing we're taught, but they never told us why.
 
  


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
Weird things going on with samba Cerb Linux - Software 2 03-29-2004 03:18 AM
Weird things on Mandrake 9.2 saurya_s Linux - Software 7 02-07-2004 09:28 PM
apache logs, seeing weird things sal_paradise42 Linux - Networking 3 01-09-2004 04:45 PM
Weird things are happening saiz66 Slackware 8 05-17-2003 12:03 AM
one of those weird kinda things Crunch General 5 03-23-2003 09:54 PM

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

All times are GMT -5. The time now is 09:55 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