0

right now i'm using this code to syncronise stuff between my pcs:

nexus_ip=$(ip neigh | grep "nexus's mac addr" | grep -Eo '^[^ ]+')
function syncit () {
# rsync -rLEAXpogtP --delete "$1" "$2"
rsync -rulOHEAXpogtP --delete "$1" "$2"
}
while read source
    do
        destination=$nexus_ip:$(echo "$source" | grep -o '^.*/')
        syncit "$source" "$destination"
    done<<\_sources_list_
/.home/younes/.bashrc
/.home/younes/.bash_logout
/.home/younes/.bashrc.original
/.home/younes/.bash_aliases
/.home/younes/.profile
/.home/younes/.passwords
/.home/younes/.sh_history
/.home/younes/.python_history
/.home/younes/.how
/.home/younes/.kde/share/apps/yakuake/skins/younes
/.bin
_sources_list_

i googled about getting ride of ssh's password while using rsync over network and all what i get that i should use "--files-from" to give rsync a list , and that way i'll enter the password just one time !

my problem is : how can i use --files-from ???

if i put all sources in a file ! what about destinations ???

i'm really confused ! any one could show me an example according to my script's infos ? please

  • Would shared ssh keys work to remove the password requirement? – David King Dec 8 '15 at 18:11
2

You can run

ssh-copy-id user@server

so you will never have to enter the passwort again.

Before that, you will have to create a local key, which you can do by running

ssh-keygen

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.