Sudo -I dont have the ubuntu password


#1

Hi, found the note that tells me to contact you if I can’t get sudo access. I don’t have a password for username “ubuntu” and I keep getting asked it while trying to figure out postgres datbabase stuff for my production environment. All help gratefully received.
Thanks very much,
Aideen

More info: I did try change my ubuntu password using more information from same details as below but also after that, and restarting everything, when trying to push a db to my development server in Heroku (eg: heroku pg:push mylocaldb HEROKU_POSTGRESQL_MAGENTA --app sushi) I get asked for my password and this is the response I get: pg_dump: [archiver (db)] connection to database “database_development” failed: FATAL: password authentication failed for user "ubuntu"
pg_restore: [archiver] input file is too short (read 0, expected 5)

Ref Jan 16th mikeumus: “Usually sudo su will give you sudo access. If you get “Authentication failure” or some other error then contact us via https://c9.io/support/reportabug39 and we’ll be able to see what’s going on in your workspace”


#2

To change the root password you type sudo passwd and it should prompt you for the new password you want to set it to.


#3

Thanks very much, that lets me change the unix pasword (Enter new UNIX password: )…but every time I try follow fixes online for my issue I always get stopped by the ubuntu password? ([sudo] password for ubuntu:
Sorry, try again.) Sorry if this is a really simple one but I’ve been leaving it off for ages and trying to figure it out while working on other things and I just can’t get it. Even trying to create superusers etc can’t be done without this password that I’m being asked for.


#4

You should be able to switch to root user by typing sudo -i.

If you cannot do that try restarting your workspace by clicking on the stats in the top right and then clicking the restart button. Then sudo should work again.

If you can switch to the root user, then once you are root user you can switch to the postgres user by typing su - postgres.

As the postgres user you should be able to push to your database. I think the issue here is that the user Ubuntu doesn’t have permission to access the database.


#5

That worked, thank you so much and for the explanation, that all makes complete sense!


#6

Hi there, I got this working at the time and I set a password for postgres. I wrote it down and when I now log into the root and then into postgres, and I try to push my db I’m asked for the postgres password. The one I created and wrote down doesn’t work. I’ve tried everything again to try change it but it keeps on asking me for the password. Is there a way of recovering it? Thanks again for your help on this


#7

…and I just figured this out…

postgres=# ALTER USER username WITH ENCRYPTED PASSWORD ‘password’;

This worked…

Thanks agian,

Aideen