Cp -Rp Nightmare unable to access /usr
Ion-Mihai Tetcu
itetcu at apropo.ro
Wed Oct 6 02:47:05 PDT 2004
On Wed, 06 Oct 2004 11:23:27 +0200
Remko Lodder <remko at 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 at it> /home/itetcu/tmp/test [12:33:33] 0 % touch test1/1
itetcu at it> /home/itetcu/tmp/test [12:33:42] 0 % touch test1/2
itetcu at 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 at 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"
More information about the freebsd-questions
mailing list