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


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 Arista device using command ssh-copy-id -i
Error attached in the file.

Can you please help me with this?


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,

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)
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/ dwarf@IP:/mnt/flash/

Step 3
On the Arista node: username dwarf sshkey file

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/ | 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.