Can someone help in writing some script through which I can transfer file (scp) from root user in abc server to crt user in hfg server and can give the crt user password in script itself so that it doesn't prompt me every time for password
Hi,
You'll have to setup the known hosts file to do this, the file should reside in the users home directory - it's better to use a regular user to do this rather than root for security reasons.
There is a good tutorial here.
Regards
Dave
Dave,
The file is coming with root user only...
Hi,
OK, then you'll have to set up the known_hosts and the authorized_keys in the .ssh sub-directory under the home directory for the root user.
There is an example tutorial at the link I posted and there are examples in the forum like the one here.
Regards
Dave
I do this all the time.
If you have your ssh keys and ssh agent setup, then this will be easy.
You will also need to use sudo.
ctr@abc> sudo scp filename ctr@hfg:/location
.
or
ctr@hfg> sudo scp ctr@abc:/fileame /location
I hope this helps