From owner-freebsd-questions@FreeBSD.ORG Wed Oct 31 13:48:01 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 3A8D616A417 for ; Wed, 31 Oct 2007 13:48:01 +0000 (UTC) (envelope-from michael.grant@gmail.com) Received: from rn-out-0102.google.com (rn-out-0910.google.com [64.233.170.191]) by mx1.freebsd.org (Postfix) with ESMTP id D195613C480 for ; Wed, 31 Oct 2007 13:48:00 +0000 (UTC) (envelope-from michael.grant@gmail.com) Received: by rn-out-0102.google.com with SMTP id s42so33692rnb for ; Wed, 31 Oct 2007 06:47:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=g4p5di1SWkw0nY/fvcJLU5RSJaYsdVNewdG1mgRHOFo=; b=kd2U7gv5A7jgumWa+ai7HYFrPMwIoA4lC95V0htCZTWIPuiJsJPn0193vItlyp4JFn3hEr1C2SPwUrbtoWJKGqxMpVYbkHGDNfuwu/IZ2k+ego76w6Wd4k5jJQOMtjvX8DY1t6emlCqSpDn3H7tK7dpCY1j3lkzkLsn79zVzxU0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=l9Hml429V+yuktUlPWdlGBIy+aiew3R/KJgg4Q/dvslRcyeAkGcL6g6nvq2six7s4H6655od6WwHw1iM1Y0LJb1PpOUQejRPc4frTJ8oeHwvb7golroKiA5+x65lkQlqJ+GqwCxzrs2QdSgVVrrf4Z4FYCujSbQn23oVj/2zJQU= Received: by 10.142.111.14 with SMTP id j14mr1983663wfc.1193836816293; Wed, 31 Oct 2007 06:20:16 -0700 (PDT) Received: by 10.64.251.5 with HTTP; Wed, 31 Oct 2007 06:20:16 -0700 (PDT) Message-ID: <62b856460710310620v588222edj620e8519643881a3@mail.gmail.com> Date: Wed, 31 Oct 2007 14:20:16 +0100 From: "Michael Grant" Sender: michael.grant@gmail.com To: James In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <62b856460710310231h3bc517cdl20300179ac6f1a39@mail.gmail.com> X-Google-Sender-Auth: 94a22492e470e348 Cc: FreeBSD Questions 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 13:48:01 -0000 On 10/31/07, James wrote: > > > > On 10/31/07, 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? > > > > 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'"