Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Oct 2004 12:47:01 +0300
From:      Ion-Mihai Tetcu <itetcu@apropo.ro>
To:        Remko Lodder <remko@elvandar.org>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Cp -Rp Nightmare unable to access /usr
Message-ID:  <20041006124701.110fddd4@it.buh.tecnik93.com>
In-Reply-To: <4163B98F.1050409@elvandar.org>
References:  <200410060735.i967ZGXL009001@emboss.bossbox.com> <4163B98F.1050409@elvandar.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 06 Oct 2004 11:23:27 +0200
Remko Lodder <remko@elvandar.org> wrote:

> Brian wrote:
> > Hi,
> > 
> > I'm running a FreeBSD 5.2.1 test box at home for Apache,PHP,MySQL.
> > 
> > I wanted to move the default mysql dabatse location from /var/db/mysql to
> > /usr/mysql
> > 
> > What I did was cp -Rp /var/db/mysql  /usr
> > 
> > I know now it was wrong for the most part I know how stupid this idea was.
> > 
> > I now can't ssh to the box I get the error below
> > 
> > Could not chdir to home directory /home/reports: Permission denied
> > /usr/local/bin/bash: Permission denied
> 
> /home lives in /usr/home so it is able that you overwrote permissions 
> for that, strangely enough you aren't even allowed to access bash, so it 
> seems to me that more happened then just a recursive copy of 
> /var/db/mysql to /usr...

Ok, here's a reproduction on what you did:

 # ll /var/db | grep my
drwx------   10 mysql     mysql         512 Oct  5 20:15 mysql

itetcu@it> /home/itetcu/tmp/test [12:33:33] 0 % touch test1/1
itetcu@it> /home/itetcu/tmp/test [12:33:42] 0 % touch test1/2
itetcu@it> /home/itetcu/tmp/test [12:35:01] 1 % ll
total 74836
drwxr-xr-x  2 itetcu  wheel       512 Oct  6 12:33 test1
drwxr-xr-x  2 itetcu  wheel       512 Oct  6 12:33 usr
itetcu@it> /home/itetcu/tmp/test [12:35:03] 0 % su
Password:
root(itetcu)@it> /home/itetcu/tmp/test [12:35:47] 1 # chown -R mysql:mysql test1
root(itetcu)@it> /home/itetcu/tmp/test [12:35:50] 0 # ll
total 74836
drwxr-xr-x  2 mysql   mysql       512 Oct  6 12:33 test1
drwxr-xr-x  2 itetcu  wheel       512 Oct  6 12:33 usr
root(itetcu)@it> /home/itetcu/tmp/test [12:35:56] 0 # chmod -R 0700 test1
root(itetcu)@it> /home/itetcu/tmp/test [12:36:16] 0 # ll
total 74836
drwx------  2 mysql   mysql       512 Oct  6 12:33 test1
drwxr-xr-x  2 itetcu  wheel       512 Oct  6 12:33 usr
root(itetcu)@it> /home/itetcu/tmp/test [12:36:17] 0 # ll test1
total 0
-rwx------  1 mysql  mysql  0 Oct  6 12:33 1
-rwx------  1 mysql  mysql  0 Oct  6 12:33 2
root(itetcu)@it> /home/itetcu/tmp/test [12:36:22] 0 # cp -Rp test1/ usr/
root(itetcu)@it> /home/itetcu/tmp/test [12:36:35] 0 # ll
total 74836
drwx------  2 mysql   mysql       512 Oct  6 12:33 test1
drwx------  2 mysql   mysql       512 Oct  6 12:33 usr

As you notice, because of -p flag now the owner / permission on usr are
those of test1, so in your case /usr now belongs to mysql and mode
0700.

At console do:
# chown root:wheel /usr
# chmow 0755 /usr

This probably will fix also the first (/home/reports) problem, as I
believe /home an your system is a symbolic link to /usr/home.



-- 
IOnut
Unregistered ;) FreeBSD "user"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041006124701.110fddd4>