From owner-freebsd-questions@FreeBSD.ORG Tue Jan 29 20:10:39 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B6F39977 for ; Tue, 29 Jan 2013 20:10:39 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx02.qsc.de (mx02.qsc.de [213.148.130.14]) by mx1.freebsd.org (Postfix) with ESMTP id 793AE378 for ; Tue, 29 Jan 2013 20:10:39 +0000 (UTC) Received: from r56.edvax.de (port-92-195-8-191.dynamic.qsc.de [92.195.8.191]) by mx02.qsc.de (Postfix) with ESMTP id 84D6A27820; Tue, 29 Jan 2013 21:10:38 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id r0TKAfpP002171; Tue, 29 Jan 2013 21:10:41 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Tue, 29 Jan 2013 21:10:41 +0100 From: Polytropon To: Ralf Mardorf Subject: Re: How to fix a broken owner for files from world & build from ports? Message-Id: <20130129211041.a7989c3b.freebsd@edvax.de> In-Reply-To: <1359458589.2199.32.camel@precise> References: <20130129082806.GA2035@holstein.holy.cow> <20130129090819.GA1372@tiny.Sisis.de> <1359458589.2199.32.camel@precise> Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: FreeBSD Questions X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2013 20:10:39 -0000 On Tue, 29 Jan 2013 12:23:09 +0100, Ralf Mardorf wrote: > On Tue, 2013-01-29 at 10:08 +0100, Matthias Apitz wrote: > > This is a mayor damage and can only be repaired by a new installation. > > Perhaps true, but if such a simple mistake can't be fixed, [...] Excuse me, it's not a _simple_ mistake. It may have initially been even a typo, but anything executed with root privileges is not simple; root has the power to do anything, even to completely destroy the system, and that can also be as simple as calling rm or dd with "carefully carelessly crafted options", and there is no simple fix for this. > [...] what happens > when somebody makes a big mistake? The size of the mistake doesn't even matter. :-) > Perhaps more people stay with Linux > than other *NIX, regarding to the policy, that issues should be fixed > instead of always starting from the beginning. ;)? The fix to your issue is, in pseudocode: for part in ( OS , ports ) do: determine owner rocketmouse:* for all files compare with list with correct owner for each deviating file do: if owner != correct owner then: chown file to correct user fi od od Of course OS and ports have to be treated seperately. As you have mentioned to own a backup where the permissions (owners) are correct, obtaining the required reference data from that backup would be the easiest part. The alternative: reinstall world, reinstall ports. To avoid this task, you need to activate your admin skills. :-) > Of course, if I simply would restore from a dump, it will be less time > consuming and it wouldn't annoy you, but I would have the bad feeling, > that if ever needed, thinks can't be fixed, I always would have to > restore from backups. And what happens, if for what reason ever a backup > shouldn't be available? In that case, you would need other references to get the correct file owners. Files are usually installed to the system by the "install" command, and it is employed in the Makefiles for the OS and also for ports. As you correctly recognized, not simply all files belong to root, so everything "non-standard" could be derived from such "control files". Of course, the more files you have to treat (see wc -l of your result list), the harder the task can become, and maybe installing the port again is faster than finding out where permissions are set for the install program call. If you only have 10 files or so, do it manually, but if there are 100 and more files, coming from several different ports, reinstalling them sounds easier, and it's not a big deal to do that with portmaster. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...