shell - SSH and agent for Ubuntu file transfer automation -


i had script used create dumps of database , transfers files ubuntu server linux machine, use scp file transfer prompts password every time, need automate it. had rsa public key of linux in ubuntu machine authorized_keys, when scp says permission denied (publickey,gssapi-keyex,gssapi-with-mic,password) checked permissions , every thing passwordauthontication off etc no luck.

can write password in script , use regardless of security provide 700 permissin , no 1 can access except me root user.

this script:

export db_dump_dir=/home/database_dump export db_name=database_name_$(date '+%y_%m_%d').sql  mysqldump -u root  mysql > ${db_dump_dir}/${db_name} if [ $? -eq 0 ];then  scp -i /root/.ssh/id_rsa  ${db_dump_dir}/${db_name} root@192.0.0.0: else     echo "error generating database dump" fi 

the first things come mind are

  • is server set allow key authentication authentication? (that's pubkeyauthentication yes in sshd_config)
  • is server allowing rsa keys? (this might rsaauthentication no in sshd_config)
  • is root's ~/.ssh directory set 700? (or tighter)
  • is root's ~/.ssh/authorized_keys set 600? (or tighter)
  • is remote machine allowing log in root? (the permitrootlogin no option in sshd_config)
  • is really right key you're sending here? did try different key created test this?

lastly, never, ever idea write password down in script. don't it. fix problem have key authentication here instead.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -