Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: some thing crazy haapened with user root

  1. #1

    Default 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
    root

    Command i ran was

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

    Any idea how to fix this,
    Best Regards,
    Ghulam Yaseen

  2. #2
    Join Date
    Sep 2008
    Location
    Dubai
    Posts
    1,770

    Default Re: some thing crazy haapened with user root

    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
    openSUSE 12.3 (x86_64) with Kernel 3.7.10-1.16-desktop and KDE 4.11.2 on MacBook Pro
    Latest MS Windows version used: Win95

  3. #3
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: some thing crazy haapened with user root

    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.

  4. #4
    natural_pilot NNTP User

    Default Re: some thing crazy haapened with user root

    > 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?

    --
    natural_pilot

  5. #5

    Default Re: some thing crazy haapened with user root

    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
    Best Regards,
    Ghulam Yaseen

  6. #6
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: some thing crazy haapened with user root

    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.

  7. #7
    Join Date
    Jan 2009
    Location
    Switzerland
    Posts
    1,529

    Default Re: some thing crazy haapened with user root

    And next time please remember to quote arguments for find.

    I guess, that your intention was:

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

  8. #8
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: some thing crazy haapened with user root

    Quote Originally Posted by vodoo View Post
    And next time please remember to quote arguments for find.

    I guess, that your intention was:

    Code:
    find /root '*.exe' -exec mv '{}' /root/quarantine/ \;
    You too left out the -name

  9. #9

    Default Re: some thing crazy haapened with user root

    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.

    Quote Originally Posted by ken_yap View Post
    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.
    Best Regards,
    Ghulam Yaseen

  10. #10
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: some thing crazy haapened with user root

    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.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •