bedtime question : xargs

David A. Bandel david.bandel at gmail.com
Thu Apr 23 05:56:39 PDT 2009


On Thu, Apr 23, 2009 at 7:44 AM, vu pham <vu at sivell.com> wrote:
> David A. Bandel wrote:
>>
>> On Wed, Apr 22, 2009 at 10:59 PM, Vu Pham <vu at sivell.com> wrote:
>>>
>>> Using xargs, how can I pipe the output ( of some command ) as the *first*
>>> parameter of some other command ?
>>>
>>> Here is my problem: I have various rpm files in a directory tree. I want
>>> to
>>> copy all of these files to a remote server using scp. What I am thinking
>>> is
>>>
>>> [oliver at xen2vm4 redhat]$ find . -name "*.rpm"
>>> ./SRPMS/hello-1.0.0-2.src.rpm
>>> ./SRPMS/hello-1.0.0-1.src.rpm
>>> ./RPMS/i686/hello-1.0.0-2.i686.rpm
>>> ./RPMS/i686/hello-1.0.0-1.i686.rpm
>>>
>>>
>>> # find . -name "*.rpm" | xargs  scp  ???   root at remoteserver:
>>
>> why invoke xargs at all?
>> find . -name \*.rpm -exec scp {} root at remoteserver: \;
>> (note:  the \; is required)
>>
>
> Thanks David. It works. It did ask me the password for every copied file but
> I could solve it with copying the id_rsa.pub over the remote machine.

Please create and copy id_dsa.pub key.  dsa is more secure than rsa.
Then make the following changes in your /etc/ssh/sshd_config file:

PermitEmptyPasswords no
ChallengeResponseAuthentication no
PasswordAuthentication no

and if you're really paranoid:
PermitRootLogin no  (then use su or sudo for root tasks)
StrictModes yes

I create dsa keys, keep the pub keys in one place, and distribute them
regularly replacing the authorized_keys file on all systems/accounts
that I need access to.

Ciao,

David A. Bandel
-- 
Focus on the dream, not the competition.
            - Nemesis Air Racing Team motto




More information about the Linux-users mailing list