0

I ran this command on my ubuntu server 12.04 by mistake:

chown someuser / -R

On RHEL it would be fixed by this command:

rpm --setugids -a

Is there anyway to fix it in ubuntu server?

2

if you have another similar server you can try:

ssh healthlyServer "find / -printf 'chown %u:%g %p \n'"|/bin/bash

ideally.. restore from backups on a brand new machine.

if you are going to run it.. check 10 times the output of

ssh healthlyServer "find / -printf 'chown %u:%g %p \n'"

before you pipe it to bash

1

If you have installed software on the box since its install, then it is unlikely you will be able to recover (with the exception of backups). Some software, during install, will create a new user. If that new user is used to set ownership on files and directories for the new program. If the OS does not have "knowledge" of those new programs, then it cannot revert ownership to the correct uid/gid. When you issued "chown someuser / -R" - you changed all files on the system. Depending upon if you had mounted filesystems from other servers and permissions were set to your disadvantage...you may have changed ownership to "someuser" on other servers as well. Further, trying to copy ownership from another box may not be advisable....user "joe" may have UID 554 on server A and "joe" may be UID 789 on server B. You would have to ensure that UIDs are not mixed between the servers...UID 554 may be for some ftp user on server B...so, copying from A to B may have undesired results.

Not the answer you're looking for? Browse other questions tagged or ask your own question.