Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


How to provide password for rsync in shell script?


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
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  
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  
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 02:03 PM.. Reason: Spelling
# 4  
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  
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 06:58 AM.. Reason: spelling
# 6  
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:
# 7  
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

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can any one provide shell script for this ...

With this script, users will be able to o Enter into the recycle bin mode. During this mode, all files deleted will be sent to the recycle bin. The recycle bin will be common to all users. o View contents of the recycle bin (his/her file(s) only). o Retrieve a particular file from the recycle... (3 Replies)
Discussion started by: bhavana busetty
3 Replies

2. Shell Programming and Scripting

How to provide password?

Hi , I am trying to unzip some file in a dir using shell script ,but it prompts for password to unzip those files ,how would i provide the passoword in the script it self (1 Reply)
Discussion started by: vikatakavi
1 Replies

3. Shell Programming and Scripting

Provide Password using to the application using the shell script

Hello, I have a requirement to shut down and start up my application on different environments (Dev, QA and Prod). I have around 24 servers. I have to login to each server manually for shutinng down the application. I wrote a shell command on each server and I am invoking those shell... (2 Replies)
Discussion started by: GDSR Raju
2 Replies

4. Shell Programming and Scripting

How the user will provide the parameters for Oracle db connection in a shell script?

I'm new into unix. My question: is possible to write a shell script which will ask for the ORACLE_HOME, ORACLE_SID, USERNAME, PASSWORD to connect to Oracle db. In generally we have to set the ORACLE_HOME in .profile file. And after putting the 'sqlplus' command it asks for the username &... (6 Replies)
Discussion started by: priya001
6 Replies

5. Programming

How to provide password to the prompt through Java

Hi All, I am using Ubuntu machine with JDK 6. I am running following command on shell- sudo ./somecript . Now, it prompts for sudo password and I provide the sudo password on shell and "somescript" starts running with sudo permissions. What I want to do is, I need to execute... (1 Reply)
Discussion started by: jaibhim
1 Replies

6. Shell Programming and Scripting

How to write a shell script for rsync to remote server?

Hello, Can you help me to write a shell script for rsync a folder from my server to remote server ? i do this in ssh by this command : rsync -avz -e ssh /copy/me/ login@serverip:/where/to i want have a shell script that do this command. and you know that this command ask remote... (0 Replies)
Discussion started by: Desperados
0 Replies

7. Shell Programming and Scripting

rsync - storing password in script

Hello, I wish to store the password in an rsync script so that when prompted it just enters the password. I know I can set up passwordless logins, but I have never been able to do this on this particular server so I am resorting to storing the password in the script: rsync -avz -e ssh... (4 Replies)
Discussion started by: stuaz
4 Replies

8. Shell Programming and Scripting

Shell Script to provide "answers" to SSL Cert Request

Hello, I need assistance with creating a shell script to generate SSL Certificate Requests on remote hosts. Below is my stab at this, but I cannot figure out how to pass the requested arguments into the openssl command correctly. I have a major problem with redirecting the "answers" into the... (2 Replies)
Discussion started by: azvelocat
2 Replies

9. Shell Programming and Scripting

how to change root password using shell script with standard password

Hi Friends. I am new to scripting now i want to change the root password using the script with standard password. which is the easy scripting to learn for the beginner, Thanks in advance. (2 Replies)
Discussion started by: kurva
2 Replies

10. Shell Programming and Scripting

provide a user password from a script

Hi all, passwd <username> < /var/adm/passwd.txt cat /var/adm/passwd.txt abcd1234 abcd1234 when I run this from the script, it comes with: New password: It is not able to pick from the location /var/adm/passwd.txt. thanks in advance. (6 Replies)
Discussion started by: solaix14
6 Replies

Featured Tech Videos