From owner-freebsd-questions@FreeBSD.ORG Wed Oct 31 15:05:35 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1870216A41A for ; Wed, 31 Oct 2007 15:05:35 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mx1.freebsd.org (Postfix) with ESMTP id BC44813C491 for ; Wed, 31 Oct 2007 15:05:34 +0000 (UTC) (envelope-from freebsd-questions@m.gmane.org) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1InCkv-00016w-Lk for freebsd-questions@freebsd.org; Wed, 31 Oct 2007 12:33:09 +0000 Received: from p5086cfcf.dip.t-dialin.net ([80.134.207.207]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 31 Oct 2007 12:33:09 +0000 Received: from HM-Gerhards by p5086cfcf.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 31 Oct 2007 12:33:09 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-questions@freebsd.org From: Michael Gerhards Date: Wed, 31 Oct 2007 13:33:30 +0100 Lines: 26 Message-ID: References: <62b856460710310231h3bc517cdl20300179ac6f1a39@mail.gmail.com> X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: p5086cfcf.dip.t-dialin.net User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.2-STABLE (i386)) Sender: news Subject: Re: ssh 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: Wed, 31 Oct 2007 15:05:35 -0000 Michael Grant wrote: > If I'm sued as root and I ssh somewhere, ssh/scp reads it's files from > /root/.ssh/. The docs say it reads from ~/.ssh which is what I want, > but it's not doing that. When sued, the shell is properly expanding ~ > to my home dir. > > Anyone know of a way around this behavior? man su says: | By default, the environment is unmodified with the exception of USER, | HOME, and SHELL. HOME and SHELL are set to the target login's default | values. USER is set to the target login, unless the target login has a | user ID of 0, in which case it is unmodified. The invoked shell is the | one belonging to the target login. So if you are sued as root, $HOME is set to /root - that's why ssh reads its configuration from /root/.ssh/ So perhaps you want to try "su -m" as the manpage says: | -m Leave the environment unmodified. HTH, Michael