cancel
Showing results for 
Search instead for 
Did you mean: 

.shosts File

 
SOLVED
Go to solution
dewa
Occasional Contributor

.shosts File

Dear All,

 

I am using .shosts file for authentication between two Linux hosts.  In order to track the usage of this file, I plan to add a comment with "#" sign after this shosts entry. So the file looks like below:

 

#more .shosts

 

serverA  user1      #For testing purposes

 

However, after adding the comment with "#" sign, it's caused the passwordless is not working. Can anyone tell me how to add a comment in shosts file?

 

 

Thanks and Regards,

Negara

 

 

 

 

 

4 REPLIES
Nighwish
Frequent Advisor

Re: .shosts File

Hello

 

 

Why not using the following approach:

 

Create a local key using ssh-keygen, don't set a password and copy
your .ssh/identity.pub to .ssh/authorized_keys on the remote machine.

Regards

Matti_Kurkela
Honored Contributor
Solution

Re: .shosts File

I looked at the sshd source code. In OpenSSH-5.9p1, the .rhosts and .shosts files are processed by the check_rhosts_file() function, which is located in source file auth-rhosts.c.

 

If I read the code correctly, comments are acceptable only if the comment character '#' is the first non-blank character on the line. If a comment is on the same line as a rhosts/shosts entry, the entire line will be ignored and if you have sshd in debug logging mode, you'll get a message "Found garbage in <filename>" in the debug output.

 

So, this should work:

# For testing purposes
serverA user1
# For other purposes
serverB user2
# having space and/or tab characters before the comment sign should be acceptable too

 

MK
dewa
Occasional Contributor

Re: .shosts File

Hi Matti,

 

This is great. Thanks for your explanation. I got the idea.

 

 

Regards,

Dewa

dewa
Occasional Contributor

Re: .shosts File

Hi Nighwish,

Thanks for your answer.


Regards,
Dewa