Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Password less SSH Login Ubuntu 12.04 Server

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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

916 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