Announcement

Collapse
No announcement yet.

Shell script sftp with user and password

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Shell script sftp with user and password

    Hello, i need to do a shell script to transfer files from a SERVER1 to a SERVER2 and i need to know how can i do connect both servers using user and password. For this case i dont want to use a public keys, only user and password. This is posible? how??
    Tnx !!

  • #2
    Try sshpass

    Code:
    export SSHPASS=login-password
    sshpass -e sftp -oBatchMode=no -b - user@192.168.1.5 << EOF
       cd folder
       put your-file.txt
       bye
    EOF

    http://www.cyberciti.biz/faq/noninteractive-shell-script-ssh-password-provider/
    English not my first language. If not understood my question ask me.

    Comment


    • #3
      Tanx its very easy.

      Originally posted by chinalinix View Post
      Try sshpass

      Code:
      export SSHPASS=login-password
      sshpass -e sftp -oBatchMode=no -b - user@192.168.1.5 << EOF
         cd folder
         put your-file.txt
         bye
      EOF

      Comment

      Working...
      X