After installing rails and trying to install PostgreSQL in the terminal (following these instructions https://www.digitalocean.com/community/tutorials/how-to-use-postgresql-with-your-ruby-on-rails-application-on-ubuntu-14-04),

I run into this when I try to set up a username using "sudo -u postgres createuser -s username":

'could not change directory to "/home/UbuntuUsername": Permission denied createuser: creation of new role failed: ERROR: role "UbuntuUsername" already exists'

How do I get around this? Any help would be greatly appreciated.

I'm completely new to Ubuntu (im running 14.04), so forgive me if this is simple to solve.


Looks like you already created a Postgres role called UbuntuUsername. Trying to do that the second time will result in an error as the role already exists. I think you can proceed with the instructions.

(the first error - "could not change directory..." is probably unimportant and harmless and is caused by sudo -u postgres ... executed in your home directory)

  • Thank you so much! I continued and everything seems to be working fine – not fell Jul 1 '15 at 22:56

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.