some thing crazy haapened with user root

Dear All,

I accidently ran a command after which the root user console look has been bad enough to make me compel to ask you guys for help.

-bash-3.1# whoami

Command i ran was

find /root *.exe -exec mv {} /root/quarantine/ ;

Any idea how to fix this,

You didn’t describe what went wrong with the use console.

What do you mean by this command?
find /root *.exe
It might not find anything. You should use:
find /root -name *.exe

Well, let’s reverse engineer what your mistake did:

find /root *.exe -exec mv {} /root/quarantine/ ;

Since most likely your /root directory has no .exe, this is passed unexpanded to find. So you asking find to look for all files under /root, and also the file '.exe’ (which does not exist), and then run the command “mv <filename> /root/quarantine/”.

As a result everything under /root gets moved to this one directory.

However there is some uncertainty since /root/quarantine is also part of the tree under /root, so I don’t know what happens to it and the files under it. Depends on whether the find sees the changes as it happens or will just refuse to move /root/quarantine to /root/quarantine/

Anyway the summary is that you have messed up everything under /root. Fortunately you may not have had much under it, except perhaps some dotfiles used by desktop environments, hence the loss of the desktop look. You should be thankful you did not specify / instead of /root.

Next time, do a dry run without the -exec to see what files are affected. If you had you would have seen that everything was included, not just .exe files.

> Any idea how to fix this,

you might try using the backup of the /root directory, to rebuild it…

have one?

i wonder where you got that string from, that wouldn’t tell you to
backup first?


yup, you guys are right…thanks God, i did not run / within that command. if this was happened! My God i could get very very big class becasue the server is most important one…actually the lesson is not to try any commands on Live server but make testing machine for such work.
I was wondering beside restoring “root” backup if recover could be possible. and also thanks to all for help

Well if you didn’t have any important files under /root, I suggest you move it out of the way, create a new /root, copy the contents of /etc/skel to it and then login and the desktop manager should create a new environment for you. But then logging in as root at the GUI, yuk, I shouldn’t even be suggesting that to you.

And next time please remember to quote arguments for find.

I guess, that your intention was:

find /root '*.exe' -exec mv '{}' /root/quarantine/ \;

You too left out the -name

Are you serious, what if i delete the root directory…
dear this server is the core server and 1 minute downtime will arrenge a big class for me…
so please what you suggest/ help make sure no downtime.

Then don’t do it until you understand what you are doing. It’s no use for me to explain all day because the understanding has to be in you.

There’s a difference between the root directory, which is /, and user “root”'s homedir which is /root. That’s where you did everything, in /root.
So no damage to the root directory of your server.

ONCE AGAIN: use su -c ‘yourcommandbetweensinglequotes’ instead of logging in as root !!!

If that server is such an important piece, you should have never executed any command as root with out understanding the consequences. If your intention was to move *.exe files to another directory, you should have just done it using simple commands.

I am thank ful to God Almighty, that the server is working fine till now…
I will not touch this server for other purposes again!

Why do you need the console gui?
All work on a server should be don in cli (text) mode.

It shouldn’t matter if the root gui desktop is broken as it should NEVER be used

Yes, servers should be running at level 3. Otherwise, it carries all the overhead of the GUI for no reason.

and, there is a big difference between “the root directory” and “/root”