0

I'm trying to modify a file from /etc/ but I can't, because the file I want to modify require root permission and I accidentally erase it.

I tried to use some sudo commands but I can't because every time i get

unknown user : root
g_p
  • 18,504
  • Normally you use sudo, sudo -e /etc/file what command did you run ? – Panther Oct 03 '14 at 02:19
  • "I accidentally erase it" Are you saying you removed the root account? How did you do that? (Or if not that, what did you do and how did you do it?) If you edit this question with more information and it turns out not to be a duplicate (and is sufficiently clear), it can be reopened. – Eliah Kagan Oct 09 '14 at 21:09

1 Answers1

1

The error message unknown user : root occurs when the user root was deleted from /etc/passwd.

Boot a live USB, mount your root partition, and post the contents of /etc/passwd .

If you are missing only root, you can add this at the top of the file

root:x:0:0:root:/root:/bin/bash

If the entire file is blank , corrupt, or incomplete, restore from backup. If you do not have a back up you can try copying the file from the live usb.

In the future, don't edit system files unless you understand what you are doing. When you do, always make a backup copy of the original file and clearly comment the changes you make. Often , but not always, comments start with a #

Panther
  • 102,067