Solved

Password less SSH Login Ubuntu 12.04 Server

Posted on 2013-12-18
3
669 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
[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
3 Comments
 
LVL 23

Assisted Solution

by:savone
savone earned 150 total points
ID: 39726894
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
ID: 39727315
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
ID: 39727779
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
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.
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.
Suggested Courses

630 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