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
sudo -i
to get to a#
. If that does not work you need to use the AWS CONSOLE from the website and see if you can log directly into root. Otherwise you killed your instance. IF your instance was created using mountable partitions you can create a new instance, mount your broken one. fix it using commands and then try to make it the bootable instance. – Rinzwind Nov 10 '20 at 18:08