scp to same server

Suppose I am in server A . I have a file at one location in server A and I want to do scp of the file to same server A but to different location without asking password ( passwordless login to same server) .Pls help

passwordless login to the same server works the same way as passwordless login to another server, you just login to localhost instead of another host.

1) In the account you wish to copy from, create keys if you don't have keys already. sh-keygen -t rsa Leave the password blank when it asks you for one!

2) ssh-copy-id username@localhost

3) You should now be able to scp localfile username@localhost:remotefile noninteractively from that account.