Find the answer to your Linux question:
Results 1 to 5 of 5
Hi guys, this is my script, I am trying to rsync to a school folder located at the school server and I am trying to bypass the password field and ...
  1. #1
    Just Joined!
    Join Date
    Jan 2010
    Posts
    3

    Bash script : Rsync + expect password not work

    Hi guys, this is my script, I am trying to rsync to a school folder located at the school server and I am trying to bypass the password field and already facing insanely amount of difficult. I have researched across the forums and tried different method but couldn't get any of them to work.. Will anyone provide me with any guide lines? thanks!

    #!/bin/sh

    /usr/bin/expect <<EOD
    rsync "testfile" "destination:folder"
    expect "password:"
    send "password\r\n"
    interact
    EOD
    I cant post URL because i don't have 15 posts or more, but let's assume that rsync "testfile" "destination:folder" works because I have try it on the command line.
    thanks

  2. #2
    Just Joined!
    Join Date
    Jan 2010
    Posts
    3
    Anyone help?

  3. #3
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    I can't be of help concerning the expect utility that I just discovered.

    I would suggest using RSA public key authentication mechanism of SSH. You won't be able to store a password in a file (I guess that's what you are trying to do). You'll have to store your private key locally using ssh-add, providing your password once only. Your public key must have been referenced by the remote SSH server. Then you can rsync transparently.

    I hope it's of help !

  4. #4
    Linux Enthusiast KenJackson's Avatar
    Join Date
    Jun 2006
    Location
    Maryland, USA
    Posts
    506
    Does your school's server have an rsync daemon running? Or do you have SSH access? Either way will work, but you must have one or the other if you have succeeded.

    If the server is running a daemon, try the --password-file option. That is, put the password in a file and pass it to rsync, something like this:
    Code:
    rsync  --password-file=$HOME/password.txt  testfile  user@server::folder/

  5. #5
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    I would suggest using RSA public key authentication mechanism of SSH. You won't be able to store a password in a file (I guess that's what you are trying to do). You'll have to store your private key locally using ssh-add, providing your password once only. Your public key must have been referenced by the remote SSH server. Then you can rsync transparently
    I expressed myself very badly, my apologies.
    Please read as follows :


    I would suggest using RSA public key authentication mechanism of SSH. You won't need to store a password in a file (I guess that's what you are trying to do). You'll have to load your private key locally using ssh-add, providing your password once only. Your public key must have been referenced by the remote SSH server. Then you can rsync transparently
    0 + 1 = 1 != 2 <> 3 != 4 ...
    Until the camel can pass though the eye of the needle.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...