'How can I grant PostgerSQL access to export a file to my desired path?

I've been trying to export a table to my Ubuntu Desktop using the following command:

\copy stock to /home/micheal/Desktop/myCSV.csv CSV HEADER

I get the following error: /home/micheal/Desktop/myCSV.csv: Permission denied

How can I grant permission to save this file? I don't want to save in the '/temp/' directory.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source