0

I used Systemback to make a restore points. Yesterday I was doing something and couldn't make things work properly, so I used Systeback to restore the system to a point in the past. The machine had about 10 people's account(though most of them are doing almost nothing yet..) The problem is, at that restore point, there were only 3 persons. I have the latest /etc/passwd file and all the 10 peoples' account intact. I tried editing /etc/passwd adding some entries for the added accounts but found users with the new accounts added after the restore point cannot log in. How can I use the /etc/passwd file and old home directories without making new accounts and linking them to old directories? (ubuntu 16.04.6)

4
  • 1
    Beyond the /etc/passwd file, did you ensure the /etc/shadow file also matched? I don't know, but I suspect some detail may be ignored in the passwd file if it contradicts the shadow file.
    – guiverc
    Jul 2, 2019 at 2:57
  • thanks, I soon found I should add the /etc/shadow file. But found the sudoers information should also be updated. Do you know what files contains the sudoers list?
    – Chan Kim
    Jul 2, 2019 at 3:00
  • 1
    /etc/sudoers ; though you should edit with visudo (it checks for errors as the file is ignored from the point an nn error is detected, and thus you can lock yourself out of sudo with a typo)
    – guiverc
    Jul 2, 2019 at 3:04
  • Thanks! I edited /etc/sudoers and it just works fine. Please make your response an answer then I'll choose it.
    – Chan Kim
    Jul 2, 2019 at 4:30

1 Answer 1

0

Some password info is also stored in /etc/shadow, so entries in that file may also need to be made (or that file restored; not just /etc/passwd)

In comments I was also asked about the location of sudoers file; it's /etc/sudoers. It's risky to edit that file directly (which I do on occasion anyway) as when it's read, if an error is detected it's treated as the EOF (end-of-file) which means any users with rights from that line on in file are ignored which can stop them using sudo. The command visudo command edits the file (using your default editor) and checks for errors before exit.

2
  • thanks! I once used visudo but the editor was something that I am not familiar with, so I made a mistake (by joining some lines..) and sudo didn't work. So I had to do su (as root) and correct the /etc/sudoers file. I thinks using visudo is trickier. :)
    – Chan Kim
    Jul 2, 2019 at 10:36
  • 1
    Have a look at askubuntu.com/questions/539243/… (ie. visudo to me makes perfect because I prefer vim being the modern version of vi) but you can change $EDITOR to something more to your tastes.
    – guiverc
    Jul 2, 2019 at 10:51

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.