Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Oct 2007 07:49:05 -0600
From:      James <oscartheduck@gmail.com>
To:        "Michael Grant" <mg-fbsd3@grant.org>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: ssh
Message-ID:  <d59e90ab0710310649y2d40a8dbrecdaa1ecd35d1e81@mail.gmail.com>
In-Reply-To: <62b856460710310620v588222edj620e8519643881a3@mail.gmail.com>
References:  <62b856460710310231h3bc517cdl20300179ac6f1a39@mail.gmail.com> <d59e90ab0710310530t79fb80c5h39f7e735d148d16a@mail.gmail.com> <62b856460710310620v588222edj620e8519643881a3@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/31/07, Michael Grant <mg-fbsd3@grant.org> wrote:
>
> On 10/31/07, James <oscartheduck@gmail.com> wrote:
> >
> >
> >
> > On 10/31/07, 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?
> > >
> > > Michael Grant
> >
> >
> > su - root
>
> Nope.  One other suggestion was 'su -l root'.  This does not change
> the situation either.
>
> I went into the source for ssh and it does a getuid() and then gets
> the homedir of that uid.  So no amount of fooling with su is gonig to
> fix this.  I guess it's like this for security reasons, it sure seems
> like a bug to me.  I'd have used the HOME enviroment variable.
>
> So far, the best fix I've found is to create some aliases in bash as
> follows:
>
> alias scp="scp -o User=username -i ~/.ssh/id_rsa"
> alias ssh="ssh -l username -i ~/.ssh/id_rsa"
> alias rsync="rsync -op -e 'ssh -l username -i /home/username/.ssh/id_rsa'"
>



Yeah, I misread your problem. Are you saying that you want to su to root,
but still have some variables set as they were on the account you sued from?
So you have a user named Michael, say, and you su to root, but when you ssh
you want Michael's .ssh to be the effective one?



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