Normally, when I transfer a dumped database from postgres CLI in my local machine, I can simply sftp my_user_name@my_ip
remotely from postgres CLI to my local machine without any problems. However, when it comes to my remote server, this seems like I have already connected with my server via ssh connection; thus, when I sudo su - postgres
to open up postgres CLI, I cannot use the same technique to
i)sftp my_user_name@my_ip
. It said request Connection timed out
; I think this may be because they are not in the same WiFI network connection.
ii) or even sftp ubuntu@ec2-xx-xx-xx-xxx.....amazonaws.com
. It said my aws ec2 server: Permission denied (public key)
I think this may result from I have made a SSH connection already, so if i sftp again, this will duplicate with the previous SSH connection.
Any idea ?? Please help