Mailinglist Archive: opensuse (4547 mails)

< Previous Next >
Re: [SLE] RE : [SLE] Script to SCP files
  • From: Bruce Marshall <bmarsh@xxxxxxxxxx>
  • Date: Fri, 28 May 2004 09:03:45 -0400
  • Message-id: <200405280903.45662.bmarsh@xxxxxxxxxx>
On Friday 28 May 2004 08:39 am, Hemond, Steve wrote:
> Ah! That`s interesting, so forget about my last post, I will try this!
>
> Thanks!
>

A shorter and neater method:

1) Use ssh-keygen to make the key with ssh-keygen -t dsa

2) cd /root/.ssh

3) ssh-copy-id -i id_dsa.pub root@<other_machine>

Done.... Try it out with just ssh <other_machine>




> Steve Hemond
> Programmeur / Programmer
> Smurfit-Stone, Ressources Forestières
> La Tuque, P.Q.
> Phone : (819) 676-8100 X2833
> Mail : shemond@xxxxxxxxxxx
>
> > -----Message d'origine-----
> > De : Rob Freeman [mailto:sysadmin@xxxxxxxxxxxx]
> > Envoyé : 28 mai 2004 08:33
> > À : suse-linux-e@xxxxxxxx
> > Objet : Re: [SLE] Script to SCP files
> >
> >
> >
> > ----- Original Message -----
> > From: "Hemond, Steve" <SHEMOND@xxxxxxxxxxx>
> > To: <suse-linux-e@xxxxxxxx>
> > Sent: Friday, May 28, 2004 7:27 AM
> > Subject: [SLE] Script to SCP files
> >
> >
> > Hi people,
> >
> > I need to migrate stuff from an Aix server to a SuSE Linux
> > server and I will
> > do this by copying the files using SCP. It works very well,
> > as long as I am
> > there to type the password!
> >
> > I would like to put many scp commands (one for each
> > filesystem i need to
> > copy) in a script but actually it won't work because I have
> > to type the
> > password for every scp command.
> >
> > Is there any way I can avoid the password prompt or maybe
> > include it in the
> > script? Or is there any better way to copy stuff like that?
> >
> > Thanks a lot for your answers,
> >
> > Best regards,
> >
> > Steve Hemond
> > Programmeur / Programmer
> > Smurfit-Stone, Ressources Forestières
> > La Tuque, P.Q.
> > Phone : (819) 676-8100 X2833
> > Mail : shemond@xxxxxxxxxxx
> >
> >
> > I do not know a whole lot about AIX, but here is how to do it
> > between to
> > linux machines:
> >
> > Basic Idea
> > No-password authentication works because of public key
> > crypto. Let's say you
> > have a local machine Ooga and a remote machine Booga. You
> > want to be able to
> > ssh from Ooga to Booga without having to enter your password.
> > First you
> > generate a public/private RSA key pair on Ooga. Then you send
> > your public
> > key to Booga, so that Booga knows that Ooga's key belongs to a list of
> > authorized keys. Then when you try to ssh from Ooga to Booga, RSA
> > authentication is performed automagically.
> > Here are detailed steps on how to do this.
> >
> >
> >
> > --------------------------------------------------------------
> > --------------
> > ----
> >
> >
> > ssh1
> > If you're using ssh1, then do this:
> > ooga% ssh-keygen -f ~/.ssh/identity
> >
> > This will generate a public/private rsa1 key pair. When it
> > asks you to enter
> > your passphrase, just hit return (i.e. leave it empty). Now
> > you need to send
> > your public key to the remote server.
> >
> > ooga% cd .ssh
> > ooga% scp identity.pub user@booga:~/.ssh
> >
> > Now you need to log into Booga and add Ooga's public key to
> > Booga's list of
> > authorized keys.
> >
> > ooga% ssh user@booga
> >
> > booga% cd .ssh
> > booga% cat identity.pub >> authorized_keys
> > booga% chmod 640 authorized_keys
> > booga% rm -f identity.pub
> >
> > That's it! You can now ssh from Ooga to Booga without entering your
> > password.
> >
> >
> >
> > --------------------------------------------------------------
> > --------------
> > ----
> >
> >
> > ssh2
> > It's harder for ssh2. There are two common implementations of
> > ssh2: OpenSSH
> > and SSH2. Let's say we want to ssh from Ooga to Booga. If
> > Ooga and Booga
> > both run the same implementation then it's easy. Otherwise,
> > we need to do
> > some extra work to make them talk to each other properly.
> > My particular situation is that my local machine is running
> > Windows 2000
> > with the Cygwin tools and OpenSSH 3.2.x. The remote machines
> > may either have
> > OpenSSH or SSH2. I'll cover these two cases below.
> >
> >
> >
> > --------------------------------------------------------------
> > --------------
> > ----
> >
> > ssh2: Ooga = OpenSSH, Booga = OpenSSH
> > First, generate a public/private DSA key pair on Ooga.
> > ooga% ssh-keygen -t dsa -f ~/.ssh/id_dsa
> >
> > When you are asked for a passphrase, leave it empty. Now send
> > the public key
> > to Booga.
> >
> > ooga% cd .ssh
> > ooga% scp id_dsa.pub user@booga:~/.ssh
> >
> > Next, log in to Booga and add the public key to the list of
> > authorized keys.
> >
> > ooga% ssh user@booga
> >
> > booga% cd .ssh
> > booga% cat id_dsa.pub >> authorized_keys2
> > booga% chmod 640 authorized_keys2
> > booga% rm -f id_dsa.pub
> >
> > Note that the filename is authorized_keys2, not
> > authorized_keys. That's it;
> > you're ready to ssh from Ooga to Booga without having to
> > enter a password
> >
> >
> > --
> > Check the headers for your unsubscription address
> > For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
> > Also check the archives at http://lists.suse.com
> > Please read the FAQs: suse-linux-e-faq@xxxxxxxx

--
+----------------------------------------------------------------------------+
+ Bruce S. Marshall bmarsh@xxxxxxxxxx Bellaire, MI 05/28/04 09:01 +
+----------------------------------------------------------------------------+
"$ not found: A)bort, R)efinance, D)eclare bankruptcy."

< Previous Next >
References