Solved

Password less SSH Login Ubuntu 12.04 Server

Posted on 2013-12-18
3
660 Views
Last Modified: 2013-12-18
I am wishing to run rsync from a cron job, but this rrthis this fails as rsync is configured to use the SSH shell, and SSH, even though I have setup keys (ssh-keygen) with empty passprases, still wants an ENTER KEY to proceed. I don't know how to make cron submit a blank ENTER. But, according to posts I find, SSH should work without  a password, including NUL ENTER.
This is my script:
#! /bin/sh
Sudo rsync -e ssh -azv /home/rrider/testfiles
rrider@greece:/home/rrider/backup
0
Comment
Question by:RayRider
3 Comments
 
LVL 23

Assisted Solution

by:savone
savone earned 150 total points
Comment Utility
Can you post an example of you trying to ssh into the greece system?  If SSH keys are setup with blank passphrase you should be dropped right into the new system without having to hit enter.
0
 
LVL 19

Accepted Solution

by:
simon3270 earned 350 total points
Comment Utility
Do you need the sudo?  This means that you must pass *root*s public key.  Does root's key have a blank line as the key?

Assuming that the original user can read the files in /home/rrider/testfiles, as long as that user's public key has been passed to the rrider user on the greece host, they will be able to write files.

If you still do need to enter a blank key, you wouldn't do it in crontab, you'd do it in the script you show.  For example:

expect 'spawn sudi rsync -e ssh -azv /home/rrider/testfiles rrider@greece:/home/rrider/backup
expect "ENTER KEY"
send "\r"
expect EOF'
0
 

Author Comment

by:RayRider
Comment Utility
This system sucks!!

I spent 15 minutes trying to explain how I fixed my problem, giving thanks to the help, selected two expects to split the points. I was in "preview" mode. when I selected the points, my comments were gone!! This is not the first time this has happened. I have to remember to DO NOT SELECT EXPERTS AND POINTS WHILE I AM PREVIEWING MY COMMENT.

Okay, the vent is over:

Briefly, I will recap once again. I had to regenerate my keys under my username. I found another ssh command: ssh-copy-id which took care of automatically updating the "authorized_keys" file on the remote host. I was doing that manually with rcp and then cat the public key into authorized_keys file. Somehow, I had it all screwed up with wrong users, etc. Also, I deleted the crontab entry which was created under 'root'. I created the crontab entry using my id, took out the sudo in the script. Now, everything works great.

Thanks to Simon for the best help as he got me off 'root'. Sorry for the lack of experience. I have been away for almost a year. I forgot how "picky" this it. Also, thanks for the EXPECT script ideas. I will look into that for future use.

Thanks,
RayRider
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

762 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

11 Experts available now in Live!

Get 1:1 Help Now