From owner-freebsd-questions@FreeBSD.ORG Wed Oct 6 09:47:04 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EAB1C16A4CE for ; Wed, 6 Oct 2004 09:47:04 +0000 (GMT) Received: from smtp.rdsnet.ro (smtp.rdsmail.ro [193.231.236.72]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2F90443D1F for ; Wed, 6 Oct 2004 09:47:03 +0000 (GMT) (envelope-from itetcu@apropo.ro) Received: (qmail 31150 invoked by uid 89); 6 Oct 2004 09:47:02 -0000 Received: from unknown (HELO it.buh.tecnik93.com) (81.196.204.98) by 0 with SMTP; 6 Oct 2004 09:47:02 -0000 Received: from it.buh.tecnik93.com (localhost.buh.tecnik93.com [127.0.0.1]) by it.buh.tecnik93.com (Postfix) with SMTP id 7B6CF4F; Wed, 6 Oct 2004 12:47:01 +0300 (EEST) Date: Wed, 6 Oct 2004 12:47:01 +0300 From: Ion-Mihai Tetcu To: Remko Lodder 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> X-Mailer: Sylpheed-Claws 0.9.12a (GTK+ 1.2.10; i386-portbld-freebsd5.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: Brian cc: freebsd-questions@freebsd.org Subject: Re: Cp -Rp Nightmare unable to access /usr X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Oct 2004 09:47:05 -0000 On Wed, 06 Oct 2004 11:23:27 +0200 Remko Lodder 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"