Monday, May 6, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 10460  / 3 Years ago, wed, june 9, 2021, 7:55:17

My OS is Ubuntu 12.10, and my account is called acgtyrant, and its UID is 1000. For the need of researching, I changed my UID from 1000 to 1010 in /etc/passwd, and then I found my files' master changed to a number:1000, which prove my suppose. But when I try to change my UID back, I found I can't edit the passwd file any more! Because when I try to run sudo vim /etc/passwd, the Bash told me sudo: unknown uid 1000: who are you?.



So how to solve it? Acctually I am a chinese student, so forgive my poor English please.


More From » passwd-file

 Answers
1

Press shift during boot then select recovery and drop to a root shell.



Now mount the file system read-write



mount -o rw,remount /


So far you are following the instructions on how to reset your password from here



Finally don't change your password but simply edit the file



vipw


To edit /etc/passwd or vipw -s to edit /etc/shadow



Similarly use vigr to edit /etc/group and vigr -s to edit /etc/gshadow



Standard editors such as nano and vim do not check the file structure before saving so may make problems worse.



reboot and all should be OK


[#32456] Wednesday, June 9, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fittecanap

Total Points: 322
Total Questions: 100
Total Answers: 105

Location: Israel
Member since Tue, Nov 17, 2020
4 Years ago
;