I am trying to transfer a file from one server to a remote server using SFTP. Client is not ready for key setup.
I am working on Solaris 10.
Here is the code.
#!/bin/ksh
# sample automatic Sftp script to dump a file
USER="user1"
PASSWORD="pass1"
HOST="host1"
sftp $USER@$HOST << EOF
$PASSWORD
cd dir1
put file1
quit
EOF
But its prompting for a password and I want to bypass entering a password.
Please let me know how can I avoid entering the password when I run the script.
ssh and scp and sftp are designed to prevent you from doing what you're trying to do, because keeping passwords in scripts is an extremely bad idea. "interactive password authentication" means "password typed by a human being in realtime authentication", and no substitutes for humans are acceptable to ssh.
The proper way to login noninteractively is to arrange ssh keys in advance.
It doesn't say to do that if you don't have ssh-copy-id, it says to do that if your server doesn't support that kind of authentication. It's a good thing you didn't manage to do so!
If you don't have ssh-copy-id you can copy the key manually:
when prompted for the remote machine's password, I keyed in the password.
But it appears that I am unable to do so; the system just hangs and I ultimately get a disconnect from the remote machine.
Does this mean I dont have access to add this public key ?