1

I was trying to change ownership of a hard-drive mounted on /media/user/ using command

sudo chwon -R user:user /media/user/

but I made a typo and ran command

sudo chwon -R user:user / /media/user/

Now everything in / is set to user(username) user(group). This system is used by me and my collegue and we cannot ssh into it since permissions have been changed. How do I revert it back to normal ?

Ravexina
  • 57,256
PoisonAlien
  • 111
  • 4

2 Answers2

2

The quickest and easiest way would take a live CD and reinstall Ubuntu. By selecting upgrade to Ubuntu, you can reinstall while keeping your files. Most applications and setting should remain.

Reference: What if I accidentally run command "chmod -R" on system directories (/, /etc, ...)

1

In short: No.

For login, you may ssh in using root (if the sshd_config allows root login, otherwise you may need a terminal so to login locally) or the user (this is to match the permission but with a chown / I'm not sure it will work).

You could restore the ownership one by one, for example, /home/user2 belongs to user2, and /var/www to www-data (takes a very long time). Besides that, the only method would be restoring from backup.