Cp -Rp Nightmare unable to access /usr

Remko Lodder remko at elvandar.org
Wed Oct 6 02:23:27 PDT 2004


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

you should chown them back to the original user (if you can still login 
as root preferable at the console, ls -lart and check the permissions on 
the directories...) and next time consider something like: cp -pr 
/var/db/mysql /usr (so that the entire directory gets copied instead of 
recursive access all dirs and copy them with file information 
preservation (permissions,timestamp etc) into /usr

If you are not able to do that, then it seems that it really got
messed up, what you can do then is use a freesbie cd (live cd) to boot 
the system, access the data on it and backup the data. Then a reinstall 
would cause everything to return to normal.

This is how i would do it, any better suggestions are of course welcome! :-)

Cheers!

> 
> What I'm looking to know is, what exactly have I done to /usr and if I'm at
> the console can I easiliy reverse what I did ?
> 
> Thanks in advance.
> 
> Brian
> 

-- 
Kind regards,

Remko Lodder                   |remko at elvandar.org
Reporter DSINet                |remko at dsinet.org
Projectleader Mostly-Harmless  |remko at mostly-harmless.nl
Founder Tienervaders           |remko at tienervaders.org


More information about the freebsd-questions mailing list