How to provide password for rsync in shell script?


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Old 03-10-2015
How to provide password for rsync in shell script?

Hi, i want to call the rsync in a shell script so that i can run it in background by passing the password within script itself. Can any one please let me know how can i provide the password in the shell script itself so that rsync will read the password when promted by the script.

Its very urgent please help.
# 2  
Old 03-10-2015
Not sure if its related to your earlier thread in usual forum.If you dont want to use keygen, expect could be the only solution for interactive programming. Google for it.
# 3  
Old 03-10-2015
It could also be an issue of an SSH id file.
I have a server I frequently upload data to, and I never ever need to login or provide any kind of password since its setup to use those keyfiles.

If you haven't already, create your personal (or any user using it) ssh keyfile, and upload the *.pub key to a specific directory which I don't know which it is.
And append the key to the list of 'authorized_keys' (which would be in the same dir as the pub key files of the users on the server.

Then 'one' can just execute rsync, and its checking the id file/key in the background allowing the user to transfer data or not.

Hope this helps

Last edited by rbatte1; 03-10-2015 at 01:03 PM.. Reason: Spelling
# 4  
Old 03-10-2015
It's generally a bad idea to try to force passwords in through scripts however you do it. They become a target for attack.

If you are struggling with the ssh-keys, you might need to check the permissions on .ssh directory and the contents.

Try setting the files to RW access to the owner and no access for anyone else plus the directory to be RWX for the owner & no access for anyone else. This is required at both the client and server side. Remember that the files on the server side should be in the correct directory of the id you are connecting to and owned by that user, not the client user issuing the original connect.


Does that help?



Robin
# 5  
Old 03-10-2015
I am using expect script. But the script stops in between after a specific period of time and all the directories and contents are not copied to the target server. Can I extend this timeout time?

Actually its for temporary purpose that's why I didn't want to use ssh keys.

Last edited by rbatte1; 03-11-2015 at 05:58 AM.. Reason: spelling
# 6  
Old 03-11-2015
What you will find out there in the world is that vast numbers of things are 'just temporary', such as the buildings I went to school in, temporary since 1928 and only demolished in 1995.

I have vast amounts of spaghetti code where temporary fixes have been applied or 'I wrote this just to do one thing' then it grows, gets re-used and we also get a myriad of other tiny bits of code strung together with string.

Whatever the job, do it properly first time. It's good training in any case.


I've also corrected lots of spelling errors in your last post because these threads are not temporary but should prove a useful mine for others in the future.



Robin
This User Gave Thanks to rbatte1 For This Post:
sea (03-11-2015)
# 7  
Old 03-13-2015
Quote:
Originally Posted by rbatte1
What you will find out there in the world is that vast numbers of things are 'just temporary', such as the buildings I went to school in, temporary since 1928 and only demolished in 1995.

I have vast amounts of spaghetti code where temporary fixes have been applied or 'I wrote this just to do one thing' then it grows, gets re-used and we also get a myriad of other tiny bits of code strung together with string.

Whatever the job, do it properly first time. It's good training in any case.


I've also corrected lots of spelling errors in your last post because these threads are not temporary but should prove a useful mine for others in the future.



Robin
I agree Mr rbattle, things are temporary in this world. But dnt you think there are many people who are going to be benefited with this temporary solution too.
There are 1000's of post which have the same solution of using ssh key authentication. I am not unaware of ssh keys. i have used ssh key for tasks before. SSH key authentication can be found as a solution in many posts. So i asked for a different one that will give another solution to the people who want something other than ssh.
And yes i dont have a perfect english, but i guess my posts are clear. Thanks for correcting it in my previous posts.SmilieSmilie
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Can any one provide shell script for this ... bhavana busetty Shell Programming and Scripting 3 09-14-2014 02:55 PM
How to provide password? vikatakavi Shell Programming and Scripting 1 07-02-2013 04:14 PM
Provide Password using to the application using the shell script GDSR Raju Shell Programming and Scripting 2 11-05-2012 08:26 AM
How the user will provide the parameters for Oracle db connection in a shell script? priya001 Shell Programming and Scripting 6 03-13-2012 06:28 AM
Shell Script to change a user password using script indrajit_renu Shell Programming and Scripting 3 11-23-2010 06:17 AM
How to provide password to the prompt through Java jaibhim Programming 1 11-15-2010 10:57 AM
How to write a shell script for rsync to remote server? Desperados Shell Programming and Scripting 0 06-04-2010 09:57 AM
get around rsync password prompt aarond OS X (Apple) 4 01-10-2010 05:34 AM
rsync - storing password in script stuaz Shell Programming and Scripting 4 12-11-2009 10:47 AM
rsync without password prompt KiranKumarKarre Shell Programming and Scripting 1 05-21-2009 01:41 PM
Shell Script to provide "answers" to SSL Cert Request azvelocat Shell Programming and Scripting 2 04-16-2009 06:10 PM
how to change root password using shell script with standard password kurva Shell Programming and Scripting 2 02-25-2009 01:35 AM
provide a user password from a script solaix14 Shell Programming and Scripting 6 01-06-2009 11:07 AM
password in shell script rajbkriz Shell Programming and Scripting 0 01-23-2008 01:17 AM
calling rsync without promting to input password mandira UNIX for Advanced & Expert Users 1 03-22-2005 04:57 PM