Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)

#!/bin/bash

#Credentials

PASS="p77Z"


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
5  
You really should be using ssh keys for this. –  Michael Hampton Jan 2 at 18:59
4  
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 at 19:02
4  
If you allow root to login via ssh with a password, then that server absolutely does not have good security implemented. –  yoonix Jan 2 at 19:10
    
Ok, anyone answer my question,I give up. How can I add ssh keys to automatize this? –  Arnoldo Bazaldua Jan 2 at 19:27
3  
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 at 19:30

1 Answer 1

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
1  
The keys can also be distributed with ssh-copy-id. –  Michael Hampton Jan 2 at 19:06

Your Answer

 
discard

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.