Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Oct 2007 13:33:30 +0100
From:      Michael Gerhards <HM-Gerhards@web.de>
To:        freebsd-questions@freebsd.org
Subject:   Re: ssh
Message-ID:  <q99mv4-ea3.ln1@asterix.hmg.homeunix.net>
References:  <62b856460710310231h3bc517cdl20300179ac6f1a39@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Michael Grant <mg-fbsd3@grant.org> 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






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?q99mv4-ea3.ln1>