I moved /etc folder to another place. Now when i use sudo mv command it says:

sudo: uid 1010 does not exist in the passwd file

there's a solution for it? it happenned in my vps by ssh. Format isn't an option. (ubuntu VPS)

  • Ejem.... Why? If you still have a root shell you can try to symlink /etc back. Or if you have physical access you can use a rescue disk/USB. Otherwise... Bad prognosis. – Rmano Jan 20 '16 at 21:31
  • it is VPS how could i do a simlynk?, moved etc/ folder to /var/www/old/ – hoheckell Jan 20 '16 at 21:35
  • From a root shell, you can just ln -s /var/was/old/etc /etc. But you need a root shell you opened before you did the move; now there is no way to acquire superuser privileges short of a physical access. – Rmano Jan 20 '16 at 21:39
  • ln: creating symbolic link `/etc': Permission denied – hoheckell Jan 20 '16 at 21:41
  • @hoheckell It's a VPS? Time to backup your data, and reinit (if it was real hardware, and you had physical access, you could boot single user and move the files back - without root access you cannot). – Elliott Frisch Jan 21 '16 at 0:18

The problem here is that the way users are authenticated for login on Ubuntu is with the /etc/passwd file. Since that file is missing... bad things are going to happen, such as sudo not working.

If you have root access somewhere, such as a session you still have open, or you can figure out how to get in as root, you can make a symlink (which is similar to a shortcut on Windows) to the new location so that the operating system can find the file. You do this with the ln command. The syntax would be:

ln -s [your new /etc location] /etc
  • ln: creating symbolic link `/etc': Permission denied can't get root access sudo: uid 1010 does not exist in the passwd file! – hoheckell Jan 20 '16 at 21:45


Now, for repairing your current system, you can do:

  1. Boot to a Live environment.

  2. Mount your current Ubuntu partition:

    sudo mount /dev/sdXY /mnt

    Change XY to your current Ubuntu partition. If unsure launch Gparted from live environment and look for something like sda1, sda2, sda3, etc.

  3. Copy the /etc back to its place i.e., /mnt/path/to/moved/etc to /mnt/etc Copy it with sudo.

  4. Exit.

    sudo reboot
  5. Now after you have booted to your installed system, you can delete the previously moved /etc folder.

  • Nice --- ;-) --- but the problem is, they have a VPS, so no physical access to the machine. No boot to a rescue environment... – Rmano Jan 21 '16 at 8:34

This is what you did by moving /etc away without an open shell with privileges:

enter image description here

Image from: http://imgur.com/gallery/eEsd4V1

... The only way out is to reset the VPS after a backup. Sorry. Remember, with sudo come great power and great responsibility...

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.