On Thu, May 04, 2000 at 12:26:17PM +1000, Cameron Simpson wrote:
> On Wed, May 03, 2000 at 10:03:30AM -0400, Michael H. Warfield wrote:
> | On Wed, May 03, 2000 at 08:09:13PM +1000, Cameron Simpson wrote:
> | > On Wed, May 03, 2000 at 01:40:33AM -0700, Mike Lewis wrote:
> | > | Trying to setup passwordless login using rsync and ssh.
> | > | Suppose you have hostname1 that multiple machines will be connecting to
> | > | using rsync / ssh.  When setting up the first machine (hostname2) to have a
> | > | passwordless login you would use:
> | > |         scp identity.pub user@hostname1:/home/username/.ssh/authorized_keys
> | > | Now we move to hostname3.  Is there a way to append identity.pub to
> | > | hostname1:/home/username/.ssh/authorized_keys using scp or does this
> | > | necessitate using vi and a temporary file ?

> | > ssh -l user hostname1 'cat >>/home/username/.ssh/authorized_keys'

> |     Just to pick a nit or two...

> |     I they couldn't have figured this one out for themselves, should
> | you also point out that they need to cat their identity.pub files into
> | the ssh command, like this:

> |     cat ~/.ssh/identity.pub | \
> |     ssh -l user hostname1 'cat >> ~/.ssh/authorized_keys'

> Doh, yeah.

> But I see thie above a lot. It is poor form to go
>       cat file | command
> when
>       command < file
> is simpler and faster. (Since we're picking nits...)

        Doh!  Touche'

> |     BTW...  Use ~/ instead of /home/username just in case their
> | home directory is NOT in /home (like root).
> 
> No no no no no!

> 1: I deliberately used the full path because the example had (I assumed that
>    /home/username was somehow different since "username" and "user" were
>    different strings).

        Ok...  Point there.  I generally try to use some distinguishing
notation like /${HOME}/${USER} or such.  The choice of /home/ was bad
because it precisely matched real values and could be mistaken as a literal.

> 2: Just say:
>       ssh -l user hostname1 'cat >> .ssh/authorized_keys' <~/.ssh/identity.pub
>     if the path is w.r.t to their home dir because ssh will run from
>     there.  Simpler.

        Yup...

> 3: "~" is NOT PORTABLE.
>    Use $HOME if you want this to work in all shells instead of just things
>    like bash.
>    ~/ is just dandy for the interactive command line if your shell
>    supports it (many do). But DO NOT use it in scripts (which generally
>    includes commands passed via ssh to some remote host). It assumes
>    special knowledge about the far end, and will break on you one day
>    if you let your fingers learn such habits.

        Hmmm...  I would have argued just the opposite, but I'm one of
the old school.  I've seen lots of times (XENIX, old SCO Unix, Microport
Unix, Interactive Unix, Masscomp RTU) where the shell variables could not
always be depended on but the ~ expansion could.  I'm not totally sure
about the old OLD classical AT&T Bourne shell, but certainly csh, tcsh,
bash, ksh and all the various varient supported the ~ expansion while
the $HOME environment variable depended upon the login process.

> Cheers,
> -- 
> Cameron Simpson, DoD#743        [EMAIL PROTECTED]    http://www.zip.com.au/~cs/

> Once a Junior Programmer interrupted a Great Guru of the Sun to ask a
> Question of no importance. The Great Guru replied in words which the Junior
> Programmer did not understand. The Junior Programmer sought to rephrase the
> Question, saying, "Stop me if I appear stupid." The great Guru, without
> speaking, reached over and pressed L1-A.
> The Junior Programmer achieved Enlightenment. - Jon Green

        Hey!  I got that one!  :-)  Cute...  "Sun"...  "Stop me"...
"L1-A" (Stop-A  - Abort to ROM/NVRAM)...  :-)  Cute...  I wonder how
many of the x86 gearheads that would have gone right past...  :-)

        Later!

        Mike
-- 
 Michael H. Warfield    |  (770) 985-6132   |  [EMAIL PROTECTED]
  (The Mad Wizard)      |  (770) 331-2437   |  http://www.wittsend.com/mhw/
  NIC whois:  MHW9      |  An optimist believes we live in the best of all
 PGP Key: 0xDF1DD471    |  possible worlds.  A pessimist is sure of it!


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to