Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I really dont need ssh keys. The server has good security implemented.

I need the script to input the password without user usage/interaction. How can I make this? Its CentOS release 6.5 (Final)




sudo rsync -rlptDvz --owner=cmsseren --group=cmsseren /home/serena/public_html/ -e ssh root@ip:/home/cmsseren/public_html3/

ssh root@ip 'chown -R cmsseren:cmsseren /home/cmsseren/public_html3/*'
share|improve this question
You really should be using ssh keys for this. – Michael Hampton Jan 2 '14 at 18:59
Yes, you really want SSH keys. Having good security on the server has no relation to the fact that using SSH keys is the solution you want to accomplish the task you've desribed in the way you describe it. – John Jan 2 '14 at 19:02
If you allow root to login via ssh with a password, then that server absolutely does not have good security implemented. – yoonix Jan 2 '14 at 19:10
Ok, anyone answer my question,I give up. How can I add ssh keys to automatize this? – Arnoldo Bazaldua Jan 2 '14 at 19:27
I agree with the above comments, also, not only it's going to be more secure to use keys buy also easier that what you are trying to do, if the easiest option is also the most secure, why go with something harder and insecure? By the way, with a cleartext password stored in a script, the other security measures are useless. – Gabriel Talavera Jan 2 '14 at 19:30

You don't want to use a password. You want to set up SSH keys. This will let you use both rsync and ssh without having to enter a password. I'm not sure you'll need the sudo on the rsync, either.

The ssh keys can be generated with the ssh-keygen utility. Check man 1 ssh-keygen for more details about how to use it.

share|improve this answer
The keys can also be distributed with ssh-copy-id. – Michael Hampton Jan 2 '14 at 19:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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