Solved

How to set up password-less SFTP between two Linux machines using public key?

Posted on 2012-03-19
7
909 Views
Last Modified: 2012-08-13
I have two Linux machines, LinMacA (192.168.28.241) and LinMacB (192.168.28.242).

I transfer files using SFTP from LinMacB to LinMacA, using usernames and passwords.

But now I want to establish a password-less SFTP using a public key so that LinMacB can transfer files to LinMacA through SFTP without having the need to enter a password.

How do I create a public key and for which machine should I create it for?

I generated a private/public key pair using PuTTY Key Generator on my Windows machine but I'm not quite sure what are the next steps.
0
Comment
Question by:killdurst
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 10

Accepted Solution

by:
MadShiva earned 250 total points
ID: 37736647
Dear,

Please read this tutorial.

SFTP SSH KEYS

If you have any problem about the setup don't hesitate to ask.

Regards
0
 
LVL 6

Assisted Solution

by:torakeshb
torakeshb earned 125 total points
ID: 37736681
0
 
LVL 1

Author Comment

by:killdurst
ID: 37736722
I've followed the ask leo steps but when I tried to execute the following command on LinMacB...

sftp useronlinmaca@192.168.28.241

I'm still prompted to enter a password.

I've ensured that RSAAuthentication and PubkeyAuthentication in sshd_config is uncommented and their values are "yes".

I've generated the private and public keys on LinMacB.

On LinMacA, at /home/useronlinmaca/.ssh, using VI, I created a file called "authorized_keys" and pasted the contents of "id_rsa.pub".

I've even restarted the SSH servvice by executing "service sshd restart" on LinMacA.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 6

Expert Comment

by:torakeshb
ID: 37736736
This is for SSH and SCP, try SCP and see whether you are able to do a  password less login
0
 
LVL 10

Expert Comment

by:MadShiva
ID: 37736999
Dear,

Check the follow :

You should put the key on the LinMacB and using the useronlinmacB@server2

You should also not enter passphrase when you have created the key.

Regards
0
 
LVL 19

Assisted Solution

by:Redimido
Redimido earned 125 total points
ID: 37740665
It is as described above, but I will try to put here the steps:

1. create the key on the LinMacB server, as the user doing the SFTP
    ssh-keygen   (follow instructions. leave all as default, no password, use RSA Key)
2. copy your ~/.ssh/id_rsa.pub from LinMacB to LinMacA, and place it there on the user's home directory under his ~/.ssh and rename the file to authorized_keys
That's it.

Troubleshooting:
If you are still prompted for the user/password, it may be due:
1. your .ssh directory permissions should be 700 or ssh will not use the keys because they are insecure.
2. you do not have the ssh server correctly configured.

To test, you should be able to ssh from LinMacB to LinMacA without having to enter a password. If this works, then SFTP should work too.
0
 
LVL 1

Author Comment

by:killdurst
ID: 37740823
Got it to work! Turns out to be some permissions issue. Thanks everyone, will distribute the points now...
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Article by: btan
Provide an easy one stop to quickly get the relevant information on common asked question on Ransomware in Expert Exchange.
As a financial services provider, your business is impacted by two of the strictest federal regulations on record: the Sarbanes-Oxley Act and the Gramm-Leach-Bliley Act. Correctly implementing faxing into your organization to provide secure, real-ti…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now