From owner-freebsd-questions@FreeBSD.ORG Sat Apr 25 12:28:23 2009 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23C12106567E for ; Sat, 25 Apr 2009 12:28:23 +0000 (UTC) (envelope-from meta@club.kyutech.ac.jp) Received: from sapphire.club.kyutech.ac.jp (sapphire.club.kyutech.ac.jp [131.206.108.7]) by mx1.freebsd.org (Postfix) with ESMTP id DD5328FC12 for ; Sat, 25 Apr 2009 12:28:21 +0000 (UTC) (envelope-from meta@club.kyutech.ac.jp) Received: from localhost (localhost [127.0.0.1]) by sapphire.club.kyutech.ac.jp (Postfix) with ESMTP id 9BF8611470; Sat, 25 Apr 2009 21:03:32 +0900 (JST) X-Virus-Scanned: amavisd-new at club.kyutech.ac.jp Received: from club.kyutech.ac.jp (rose.club.kyutech.ac.jp [131.206.108.6]) by sapphire.club.kyutech.ac.jp (Postfix) with ESMTP id 7433A11469; Sat, 25 Apr 2009 21:03:17 +0900 (JST) Date: Sat, 25 Apr 2009 21:03:16 +0900 From: Kouichiro Iwao To: Ruben de Groot Message-ID: <20090425120316.GB31588@club.kyutech.ac.jp> References: <20090423073229.GA87987@club.kyutech.ac.jp> <20090423091027.GA47290@ei.bzerk.org> <20090423181711.GH40655@hal.rescomp.berkeley.edu> <20090425083416.GA31588@club.kyutech.ac.jp> <20090425092222.GA75517@ei.bzerk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Content-Disposition: inline In-Reply-To: <20090425092222.GA75517@ei.bzerk.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: questions@freebsd.org Subject: Re: how to deceive programs as if I were a local user? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Apr 2009 12:28:23 -0000 On Sat, Apr 25, 2009 at 11:22:22AM +0200, Ruben de Groot wrote: > > Configuring nsswitch.conf in linux emulation environment, > > the program worked properly. I did't know I had to set > > /compat/linux/etc/nsswitch.conf for linux binary compatibility. > > That's interesting. Was there a /compat/linux/etc/nsswitch.conf before? > I think that if it's not there, the linux emulation layer should take > the system's /etc/nsswitch.conf as default. But I might be wrong(TM). What does TM mean? :-( Yes. I didn't make /compat/linux/etc/nsswitch.conf but just modified the file that had already existed. I also configured /compat/linux/etc/yp.conf and /compat/linux/etc/sysconfig/network to use NIS. I examined the linux emulator takes /compat/linux/etc/nsswitch.conf. /etc/nsswitch.conf: $ grep -v -e ^$ -e ^# /etc/nsswitch.conf group: compat group_compat: nis hosts: files dns networks: files passwd: compat passwd_compat: nis shells: files services: compat services_compat: nis protocols: files rpc: files /compat/linux/etc/nsswitch.conf: $ grep -v -e ^$ -e ^# /compat/linux/etc/nsswitch.conf passwd: files nis shadow: files nis group: files nis hosts: files dns bootparams: nisplus [NOTFOUND=return] files ethers: files netmasks: files networks: files protocols: files rpc: files services: files netgroup: nisplus publickey: nisplus automount: files nisplus aliases: files nisplus And the sample program "sample.c": #include #include #include int main(){ struct passwd *pw; pw = getpwuid(getuid()); if(pw){ printf("success\n"); } else { printf("error\n"); } } I compiled the sample for both freebsd and linux binaries. With the setting above I ran each binary, both binaries resulted success. But when "nis" is not written in linux emulation environment's nsswitch.conf, the linux binary results error. -- Iwao, Koichiro