I have an Ubuntu server on which I have installed Docker and some Docker images. One of the images is for matrix.org, which created a volume with some configuration files.

I need to make a backup of this configuration file on my local machine. I can use vi to open the file and edit it but when I try to open the directory I get a permission denied error. How can I make a backup of this file on my local machine?


If you're trying to copy the file to your local machine it should be enough to run sudo scp username@ip-adress:/path/to/file /path/to/where/you/want/to/put/the/file on your local machine. Note that this makes scp use the root user's ssh credentials so any ssh keys or configuration you've set up for yourself won't work.

  • I got the following message : scp: /var/lib/docker/volumes/synapse-data/_data/homeserver.yaml: Permission denied – Amira Elsayed Aug 9 '19 at 1:47
  • @AmiraElsayed Does your user on the remote server not have sudo privileges? Could you check the permissions on the directories leading up to the file? Try making all directories executable for anyone if they aren't already. – fixgoats Aug 9 '19 at 1:52
  • @AmiraElsayed It also seems strange to me to make a backup of such a file. I'm no Synapse or Docker expert but are you sure there isn't any better approach for what you're trying to achieve? – fixgoats Aug 9 '19 at 2:11
  • I have a sudo permission and I can access the file itself but can not copy it or access it is parent directory – Amira Elsayed Aug 9 '19 at 2:58
  • I keep change the configuration of the file and I want to have version of the working file to be able to back to it in case anything wrong happen – Amira Elsayed Aug 9 '19 at 2:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.