Solved

Password less SSH Login Ubuntu 12.04 Server

Posted on 2013-12-18
3
662 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
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
linux installs 6 60
AWS - HAProxy- KeepAlived 5 43
Linux Copy Command - All Files inc Directory 1 42
000webhost.com default error log 1 28
Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
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 …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.:

773 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