0

I am new to Linux environment and I need little guidance. I made a mistake while setting up the password and username of mosquito MQTT broker on AWS ubuntu 18.04 instance. I have altered the contents of /etc/passward file. Because of this sudo is completely broken. Whenever I try to give commands related to sudo, I am getting the above mentioned error. Later I found out there is another backup file in /etc/passward- file. So I need to copy the contents of /etc/passward- to /etc/passward in order to restore sudo. I tried using normal cp command but unfortunately I got an error saying "Permission denied". Is there anyway I can copy without using sudo?

NOTE: I am using AWS ubuntu 18.04 linux instance.

Any suggestions are welcomed.

Thank you

1 Answers1

0

Obviously the password file is protected from update. It is almost certain you're going to need root access there.

  1. Try sudo (in this case, it didn't work)

  2. Try signing in with root's password or perhaps using the su command as in

    su root

  3. Something I've not tried, what if you could mount the harddrive using a system booted from say a USB stick. In that instance, you probably have root and sudo access (on the stick) if the operating system is coming from the stick. In that situation, the password file of the harddrive is just a file which the stick's root should be able to modify/replace.

quill
  • 1,015