(1) I want to upload some files to a server
for (( i=0 ; i < 23 ; i+=1 )); do echo mypassword | scp email@example.com:project/$i/train10000/finer_search_c_g ~/project/$i/train10000/ done
I hope that by pipe my password to scp, the loop will be executed without interaction. However it still asks me to manually input the password. How should I specify mypassword to scp?
(2) I do not use authentication keys generated by ssh-keygen because the server actually is a head node of a cluster. I found that if I use ssh-keygen to generate authentication keys, the files under ~/.ssh will make the access between nodes requiring password, which I cannot find a solution. Is it possible to make the access between nodes with empty password while using authentication keys to access head node from outside the cluster?
THanks and regards!