Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

closed as off topic by Chris S Dec 13 '12 at 14:19

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Please see… – Chris S Dec 13 '12 at 14:19

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

share|improve this answer

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 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, copying from A to B may have undesired results.

share|improve this answer

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