Topic: Accidentally moved system files! Pages that link to <a href="https://ozoneasylum.com/backlink?for=29568" title="Pages that link to Topic: Accidentally moved system files!" rel="nofollow" >Topic: Accidentally moved system files!\

 
Author Thread
zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 09-29-2007 02:17 Edit Quote

I was in my server under root and did a simple move and forgot the dot before the forward slash. This gave me undesired results, very undesired results. Please look at the following:

code:
root@fusion [/home/smallcm/public_html]# ls -l
total 16
drwxr-x--- 4 smallcm nobody  4096 Sep 28 18:51 ./
drwx--x--x 7 smallcm smallcm 4096 Sep 28 18:37 ../
drwxr-xr-x 2 smallcm smallcm 4096 Sep 28 18:23 cgi-bin/
drwxr-sr-x 9   27743   27744 4096 Jul 26 15:25 drupal-5.2/
root@fusion [/home/smallcm/public_html]# mv /drupal-5.2/* /*
mv: cannot stat `/drupal-5.2/*': No such file or directory
mv: cannot move `/lib' to `/var/lib': Directory not empty
mv: cannot move `/proc' to `/var/proc': Device or resource busy
mv: cannot move `/tmp' to `/var/tmp': Directory not empty
root@fusion [/home/smallcm/public_html]# mv ./drupal-5.2/* ./*
bash: /bin/mv: No such file or directory
root@fusion [/home/smallcm/public_html]#


That's what I did after downloading, extracting, then deleting "drupal-5.2.tar.gz".

I have contacted my host about the issue, they said I'm probably going to have to "reprovision" my server. They also said to contact them over the support ticket system (I'm on the phone with the guy) as the guys more specialized can take care of it from there. So now I'm waiting for a response.

OS: Red Hat Fedora Core 6 (with WHM/cPanel and a several sites I'd like to keep)

zavaboy
Paranoid (IV) Inmate

From: f(x)
Insane since: Jun 2004

IP logged posted posted 09-29-2007 04:06 Edit Quote

Solved! (I believe...)

code:
root@fusion [/]# cd /var
root@fusion [/var]# /var/bin/mv -t / bin boot dev etc home lib media mnt opt root sbin selinux srv sys tmp usr
/var/bin/mv: cannot move `lib' to `/lib': Directory not empty
/var/bin/mv: cannot move `tmp' to `/tmp': Directory not empty
root@fusion [/var]#



I don't know what those error/notice messages mean. It seems to have fixed my problems. I compared the directories on my CentOS I have here at home to know which ones to restore to the root directory. I still need to check if I moved any cPanel files/directories. If there are any system files or directories which you believe I did not move back, please let me know.

Directory listings of "/" and "/var":

After I messed it up:

code:
root@fusion [/]# /var/bin/ls -l
total 12
drwxr-xr-x   12 0 0 4096 Sep 20 09:43 lib
dr-xr-xr-x 4100 0 0    0 Jun  7 04:34 proc
drwxrwxrwt    5 0 0 4096 Sep 28 22:51 tmp
drwxr-xr-x   37 0 0 4096 Sep 28 22:53 var

code:
root@fusion [/var]# /var/bin/ls -l
total 172
lrwxrwxrwx  1 0  0    39 Sep 28 22:23 aquota.group -> /proc/vz/vzaquota/00000094/aquota.group
lrwxrwxrwx  1 0  0    38 Sep 28 22:23 aquota.user -> /proc/vz/vzaquota/00000094/aquota.user
drwxr-xr-x  2 0  0  4096 Sep 20 09:43 bin
drwxr-xr-x  2 0  0  4096 Oct 10  2006 boot
drwxr-xr-x  8 0  0  4096 Jun  7 04:48 cache
drwx--x--x 42 0  0  4096 Sep 28 22:25 cpanel
drwxr-xr-x  3 0  0  4096 May 30 07:14 db
drwxr-xr-x  4 0  0  4096 Jun  7 05:10 dev
drwxr-xr-x  3 0  0  4096 May 30 07:14 empty
drwxr-xr-x 72 0  0 12288 Sep 28 22:28 etc
drwxr-xr-x  2 0  0  4096 Oct 10  2006 games
drwx--x--x 23 0  0  4096 Sep 28 22:23 home
drwxr-xr-x  8 0  0  4096 Jun  7 04:50 installd
drwxr-xr-x 13 0  0  4096 Jun  7 04:52 lib
drwxr-xr-x  2 0  0  4096 Oct 10  2006 local
drwxrwxr-x  3 0 54  4096 May 30 07:11 lock
drwxr-xr-x  8 0  0 12288 Sep 29 01:24 log
lrwxrwxrwx  1 0  0    10 May 30 07:11 mail -> spool/mail
drwxr-xr-x  2 0  0  4096 Oct 10  2006 media
drwxr-xr-x  2 0  0  4096 Oct 10  2006 mnt
drwxr-xr-x  5 0 25  4096 Sep 28 22:23 named
drwxr-xr-x  2 0  0  4096 Oct 10  2006 nis
drwxr-xr-x  2 0  0  4096 Oct 10  2006 opt
drwxr-xr-x  2 0  0  4096 Jul  6 17:25 perl
drwx------  2 0  0  4096 Jan 30  2002 portsentry
drwxr-xr-x  2 0  0  4096 Oct 10  2006 preserve
drwxr-x--- 11 0  0  4096 Sep 28 22:24 root
drwxr-xr-x 16 0  0  4096 Sep 28 09:41 run
drwxr-xr-x  2 0  0  4096 Sep 26 09:40 sbin
drwxr-xr-x  5 0  0 20480 Sep 28 09:39 scripts
drwxr-xr-x  2 0  0  4096 Oct 10  2006 selinux
drwxr-xr-x 13 0  0  4096 Sep 12 09:40 spool
drwxr-xr-x  2 0  0  4096 Oct 10  2006 srv
drwxr-xr-x  2 0  0  4096 Oct 10  2006 sys
drwxrwxrwt  2 0  0  4096 Sep 26 09:41 tmp
drwxr-xr-x 16 0  0  4096 Jun  7 05:34 usr
drwxr-xr-x  6 0  0  4096 May 30 07:14 www
drwxr-xr-x  2 0  0  4096 Oct 10  2006 yp



After I fixed it:

code:
root@fusion [/]# ls -l
total 112
drwxr-xr-x   22 root root  4096 Sep 28 23:25 ./
drwxr-xr-x   22 root root  4096 Sep 28 23:25 ../
-rw-r--r--    1 root root     0 Jun  7 00:34 .autofsck
-rw-r--r--    1 root root     0 May 30 10:00 .autorelabel
drwx------    2 root root  4096 Jun  7 00:44 .gnupg/
-rw-------    1 root root  1024 Jun  7 01:18 .rnd
lrwxrwxrwx    1 root root    39 Sep 28 18:23 aquota.group -> /proc/vz/vzaquota/00000094/aquota.group
lrwxrwxrwx    1 root root    38 Sep 28 18:23 aquota.user -> /proc/vz/vzaquota/00000094/aquota.user
drwxr-xr-x    2 root root  4096 Sep 20 05:43 bin/
drwxr-xr-x    2 root root  4096 Oct 10  2006 boot/
drwxr-xr-x    4 root root  4096 Jun  7 01:10 dev/
drwxr-xr-x   72 root root 12288 Sep 28 23:25 etc/
drwx--x--x   23 root root  4096 Sep 28 18:23 home/
drwxr-xr-x   12 root root  4096 Sep 20 05:43 lib/
drwxr-xr-x    2 root root  4096 Oct 10  2006 media/
drwxr-xr-x    2 root root  4096 Oct 10  2006 mnt/
drwxr-xr-x    2 root root  4096 Oct 10  2006 opt/
dr-xr-xr-x 4089 root root     0 Jun  7 00:34 proc/
drwxr-x---   11 root root  4096 Sep 28 23:02 root/
drwxr-xr-x    2 root root  4096 Sep 26 05:40 sbin/
drwxr-xr-x    5 root root 20480 Sep 28 05:39 scripts/
drwxr-xr-x    2 root root  4096 Oct 10  2006 selinux/
drwxr-xr-x    2 root root  4096 Oct 10  2006 srv/
drwxr-xr-x    2 root root  4096 Oct 10  2006 sys/
drwxrwxrwt    5 root root  4096 Sep 28 23:24 tmp/
drwxr-xr-x   16 root root  4096 Jun  7 01:34 usr/
drwxr-xr-x   22 root root  4096 Sep 28 23:25 var/

code:
root@fusion [/var]# ls -l
total 96
drwxr-xr-x 22 root root   4096 Sep 28 23:25 ./
drwxr-xr-x 22 root root   4096 Sep 28 23:25 ../
drwxr-xr-x  8 root root   4096 Jun  7 00:48 cache/
drwx--x--x 42 root root   4096 Sep 28 23:34 cpanel/
drwxr-xr-x  3 root root   4096 May 30 03:14 db/
drwxr-xr-x  3 root root   4096 May 30 03:14 empty/
drwxr-xr-x  2 root root   4096 Oct 10  2006 games/
drwxr-xr-x  8 root root   4096 Jun  7 00:50 installd/
drwxr-xr-x 13 root root   4096 Jun  7 00:52 lib/
drwxr-xr-x  2 root root   4096 Oct 10  2006 local/
drwxrwxr-x  3 root lock   4096 May 30 03:11 lock/
drwxr-xr-x  8 root root  12288 Sep 28 23:38 log/
lrwxrwxrwx  1 root root     10 May 30 03:11 mail -> spool/mail/
drwxr-xr-x  5 root named  4096 Sep 28 18:23 named/
drwxr-xr-x  2 root root   4096 Oct 10  2006 nis/
drwxr-xr-x  2 root root   4096 Jul  6 13:25 perl/
drwx------  2 root root   4096 Jan 29  2002 portsentry/
drwxr-xr-x  2 root root   4096 Oct 10  2006 preserve/
drwxr-xr-x 16 root root   4096 Sep 28 05:41 run/
drwxr-xr-x 13 root root   4096 Sep 12 05:40 spool/
drwxrwxrwt  2 root root   4096 Sep 26 05:41 tmp/
drwxr-xr-x  6 root root   4096 May 30 03:14 www/
drwxr-xr-x  2 root root   4096 Oct 10  2006 yp/



Edit: I compared directory listings with a friend with a similar server configuration. Moved the "/var/aquota.group" and "/var/aquota.user" files and "/var/scripts" directory to "/". Everything should be the way it was as far as I can see.



(Edited by zavaboy on 09-29-2007 05:48)

(Edited by zavaboy on 09-29-2007 06:51)

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 09-29-2007 12:04 Edit Quote

That's what you get by working as root!
Don't do that

Fortunatly, linux is rather robust in this regard - though
if it will survive the next reboot will be an interesting bet.

So long,

->Tyberius Prime



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu