I am using RedHat 4.4 Version Operating System.
I want to copy one file from source to destination.I don't want to give a password when I am executing the below shell script.
code:
#!/bin/bash
scp -r file.zip 192.168.1.5:/root/
Here it asking a password to enter,Is there any way give a password in a shell script.
You can use expect script for same, in that either you can use the password(Which is not one of the best ways) or you can create a file which has password with proper permissions say 400 and call it in expect script. Following URL may help you. Passing arguments to an Expect script as variables