ssh

Michael Gerhards HM-Gerhards at web.de
Wed Oct 31 08:05:35 PDT 2007


Michael Grant <mg-fbsd3 at 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





More information about the freebsd-questions mailing list