Solved

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

Posted on 2012-03-19
7
929 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 7

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
Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

 
LVL 7

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:Gabriel Orozco
Gabriel Orozco 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
When trying to install php-fpm on CentOS 7 - GPG error 2 94
Redhat upgrade 1 48
Advice on ESXi 5.1 Health / Storage 1 44
DB2 9.7 Grant Execute SP 4 12
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
Worried about if Apple can protect your documents, photos, and everything else that gets stored in iCloud? Read on to find out what Apple really uses to make things secure.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

749 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