I have 2 servers, Server1
and Server2
. On Server1
I have a user named user1
. On Server2
I have the user named user2
.
I need to be able to write a script that runs on Server1
, which will scp
some files to user2@Server2
. Is there any way to do this without prompting for a password? I can put the password in a config file or something if necessary.
I am not able to create user2@Server1
user by the way.
scp
to a remote server using the same username as the local account is exactly no different than doing it with a different username. If one works, the other will work too, you just have to specify the username otherwise the default is to use the same username!