With the public key from root@COMPUTER1 placed in COMPUTER2:/root/.ssh/authorized_keys, you should be able to use almost exactly your desired command, just change:
scp /home/user/filename user@COMPUTER2:/home/user/
to
scp /home/user/filename root@COMPUTER2:/home/user/
This reflects the fact that you've placed your public key in COMPUTER2:/root/.ssh/authorized_keys which gives you public key (vs password) access on COMPUTER2 as root (not user)
There's probably a gotcha here. While you'll be able to copy the file using the above, it will be created by and owned by root. The default permissions mean this file is likely unreadable, unwritable or both by user on COMPUTER2. If this isn't what you want, you may want to place the public key in ~user/.ssh/authorized_keys (/home/user/.ssh/authorized_keys) and then use your orignal command which then creates the file as user on COMPUTER2 (i.e. owned by user with default permissions.)
|