Could not change directory to "/root": Permission denied

I get this error when trying to set up Peertube:

could not change directory to « /root »: Permission denied

Full Error:

root@peertube:~# sudo -u postgres psql -c « CREATE EXTENSION unaccent; » peertube_prod
could not change directory to « /root »: Permission denied
CREATE EXTENSION
root@peertube:~#

Are you sure it doesn’t work ? The error is because you are in the /root folder, and the user postgres has no right in this folder. But I think it worked.
If it does not, you can try to change the directory before (go in /var/www/peertube for example)

1 « J'aime »