Posted on April 26, 2019 6:54 pm
 |  Asked by Nilesh Bhadane
 |  127 views
0
0
Print Friendly, PDF & Email

HI,

I have ansible installed on my machine.
I have added device name inside the host file. I have generated a key using ssh-keygen.

But getting an error while copying the key to the lab00.arista.com Arista device using command ssh-copy-id -i lab.device.com
Error attached in the file.

Can you please help me with this?

Thanks,
Nilesh

Attachments:
0
Posted by Himanshu Singh
Answered on April 29, 2019 9:45 am

Hi Nilesh,

Can you please try the following and see if it works:
$ ssh-copy-id -f -i root@

Thanks and regards,
Himanshu

Giving the same error

> exec sh -c ‘cd ; umask 077 ; mkdir -p .ssh && cat >> .ssh/authorized_keys || exit 1 ; if type restorecon >/dev/null 2>&1 ; then restorecon -F .ssh .ssh/authorized_keys ; fi’
% Invalid input at line 1

(Nilesh Bhadane at April 29, 2019 7:51 pm)
0
Answered on May 7, 2019 3:23 pm

Step 1
On your local machine :ssh-keygen -t rsa -b 4096

Step 2
From your local machine :scp ~/.ssh/id_rsa.pub dwarf@IP:/mnt/flash/dwarf_rsa.pub

Step 3
On the Arista node: username dwarf sshkey file flash:dwarf_rsa.pub

0
Posted by Tony Bourke
Answered on July 4, 2019 10:55 pm

The problem is the remote shell is SessionCLI, not Bash. ssh-copy-id is a script that relies on the shell of the remote system bing bash/csh/tcsh/sh. The error comes from SessionCLI not knowing what cat is.

You can do this command another way:

cat ~/.ssh/id_rsa.pub | ssh arista@device 'bash cat >> ~/.ssh/authorized_keys'

Or you can edit the ssh-copy-id script to put “bash” before whatever command it uses to put the authorized key file in.

Post your Answer

You must be logged in to post an answer.