Reputation: 53
I'm logged into remote using ssh
ubuntu@ubuntu:~$
now I switch to postgres account using sudo su - postgres
command and it send me to postgres@ubuntu:~$
now here I'm able to take dump using pg_dump
command.
e.g. postgres@ubuntu:~$ pg_dump db_name > mydbdump.sql
so far looks good. but from here I want to copy this dump file to my local machine or even to my origin/default ubuntu user on remote(ubuntu@ubuntu:~$). so that from there I can scp
.
how do I copy these dump sql files from postgres acccount to ubuntu on remote?
Upvotes: 2
Views: 3007
Reputation: 1865
If you are using ubuntu, default directory would be /var/lib/postgresql
so you can directly scp
from remote to local.
On your local machine run this command
user@user:~$ scp [email protected]:/var/lib/postgresql/mydbdump.sql /path/to/local/dir
Upvotes: 3