You should be able to use either the
root user or a
sudo user, if you’ve created one. The
root user has global permissions and should be able to read & write from any location.
If you’re not able to write to a file or directory on the block storage using a normal, non-root, non-sudo user (i.e.
www-data), it’d be because the user you’re trying to read or write with doesn’t have proper permissions to do so and the device (if you used DigitalOcean’s guide) is owned by
You’d need to change ownership, or
chown the files and directories so that they are owned by the user you’re trying to use to read and write with before that user will be allowed to do so.
You can do this like so:
chown user:user /path/to/directory
chown user:user /path/to/file.txt
or if you want to do it recursively (for when you have multiple directories and files in one directory and need them all to be owned by a specific user:
chown -R user:user /path/to/directory
The above command will change ownership on ALL files and directories under