Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Password less SSH Login Ubuntu 12.04 Server

Posted on 2013-12-18
3
Medium Priority
?
677 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 600 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 20

Accepted Solution

by:
simon3270 earned 1400 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Fine Tune your automatic Updates for Ubuntu / Debian
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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

722 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