From owner-freebsd-questions@FreeBSD.ORG Fri Jan 25 14:04:20 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 3893CDB5 for ; Fri, 25 Jan 2013 14:04:20 +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 DC84AC2C for ; Fri, 25 Jan 2013 14:04:19 +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 46974277D3; Fri, 25 Jan 2013 15:04:11 +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 r0PE4EGk003421; Fri, 25 Jan 2013 15:04:14 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Fri, 25 Jan 2013 15:04:14 +0100 From: Polytropon To: "Ralf Mardorf" Subject: Re: Sharing a mail folder between Linux and FreeBSD Message-Id: <20130125150414.f262d162.freebsd@edvax.de> In-Reply-To: References: <20130125133346.f1484ed8.freebsd@edvax.de> 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 quest 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: Fri, 25 Jan 2013 14:04:20 -0000 On Fri, 25 Jan 2013 14:48:19 +0100, Ralf Mardorf wrote: > On Fri, 25 Jan 2013 13:33:46 +0100, Polytropon wrote: > >> $ ls -l `which su` > >> -r-sr-xr-x 1 rocketmouse wheel 16880 Dec 23 18:38 /usr/bin/su > > > > Erm... that looks horribly wrong. > > > > The permissions indicate that setuid is set, but the file > > owner is wrong. For comparison: > > > > -r-sr-xr-x 1 root wheel 14604 2011-08-21 20:24:28 /usr/bin/su* > > > > This program has to belong to root. It seems that your > > attempt to reflect UID changes in the file permissions > > exceeded the scope of this task: Programs of the OS > > seem to be affected, which is definitely not good. > > IMO setuid alone already is a security risk. The su program is part of the operating system, so it can safely be considered safe. :-) > >> $ ls -l /home/ | grep rocketmouse > >> drwxr-xr-x 28 rocketmouse rocketmouse 1536 Jan 25 12:17 > >> rocketmouse > > > > You can use ls -ld to omit the grep step. :-) > > $ ls -ld /home/rocketmouse > drwxr-xr-x 28 rocketmouse rocketmouse 1536 Jan 25 13:19 > /home/rocketmouse > > :) > > I was sure that using grep is stupid and should have done a 'man ls', > since 'help' wasn't helpful. That's why "man ls" exists. :-) > This issue and 'cat | grep' instead of grep > only are common mistakes by many Linux users. This reminds me to "useless use of 'cat'" which is often used because it constructs a convenient and easy to read "chain" of commands, but can often be avoided, especially when files can be redirected from. > > Do you have other files in /usr or even /usr/local that do > > belong to rocketmouse (uid == 1000 or 1001) now? That should > > not have happened... > > /usr/bin is ok > /usr/include is ok > /usr/include/* seem to be ok, I just checked some > folders > /usr/lib and /usr/lib/* are ok > /usr/libdata and /usr/libdata/* are ok > /usr/libexec and /usr/libexec/*/* are ok > /usr/ports is ok > /usr/ports/* seem to be ok, I just checked some > folders > /usr/sbin is ok > /usr/share is ok > /usr/share/* seem to be ok, I just checked some > folders > /usr/src is ok > /usr/src/*/* seem to be ok, I just checked some > folders > > /usr/local is ok > /usr/local/bin and /usr/local/bin/* are ok > /usr/local/bootstrap* and [...]/* are ok > /usr/local/etc is ok > /usr/local/etc/* seem to be ok, at least PolicyKit and > ConsoleKit are > /usr/local/include is ok > [snip] > > All /usr/local/* are ok and all /usr/local/*/* seem to be ok. > Other directories in /usr and /usr/local are empty. You can do something like this: % ls -lR / | grep -v "/home" | grep "rocketmouse" This will probably show some "false-positives" in /tmp and maybe in /var, but should show nothing in /usr directly (or in other top level system directories). > OT: /usr/lib32 and /usr/lib32/* belong to the empty folders in /usr. Allow me a polite note regarding terminology: There are no folders. Those are called directories. This is the valid technical term. A "folder" is the name of a typical GUI representation element _for_ a directory. Relations: "is a" vs. "represents a" or "looks like a". I know it's common to call directories "folders", but this is as wrong as calling a device driver "Bob". ;-) > So > FreeBSD is multi arch capable? > (since there's /usr/ports/astro/google-earth for amd64, I suspect it is) The system shares some stuff across architectures, and it's possible to run 32 bit applications on a 64 bit system, so specific "fixed bit width libraries" are provided. This is reflected in naming conventions. Even though the installer might create those directories in advance, it's possible that they only receive content under specific circumstances. Ports do usually work on both systems. Those that do _not_ have a checking mechanism in their Makefile that indicates on which platform they don't build, or if they are designed for one specific platform only. > > Some programs check by whom they are called or who they > > belong to; if that's != root when it is _supposed_ to > > be root, that can cause problems, especially when it's > > not a simple x (execute), but s (setuid) program like > > an X display manager. > > So I guess I only need to correct the owner for /usr/bin/su. If that's the only occurance, it should be sufficient. > $ ls -l /usr/bin/su > -r-sr-xr-x 1 root wheel 16880 Dec 23 18:38 /usr/bin/su > > I wonder if setting suid is needed, while the kit family is installed. For > sure it's possible to add a rool to some kit config. The su program is part of the OS, while things like PolicyKit are additional software. It sounds doubleplusungood to modify a standard (!) system setting at file permission level for such a purpose. > Restart > > PPPoE was enabled automagically :). You probably have the required magic in /etc/rc.conf. :-) > $ su > Password: > You have mail. > root@freebsd:/usr/home/rocketmouse # :) > > Ctrl + Alt + F* will switch to ttyv* and su does work too. :) Because su will work everywhere it's supposed to work. :-) > So the switch to uid 1000 seem to be complete now, without any gaps. Just to make sure, check with the ls | grep command listed above. Nothing "surprising" should show up in the result. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...