2

I'm trying to use ssh-copy-id in order to copy my id_rsa.pub into ~/.ssh/authorized_keys in remote host.

I execute the following:

$ ssh-copy-id remoteuser@remotehost

But I have the following error:

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
remoteuser@remotehost's password: 
rootsh: bad characters in arguments
2

It looks like this server is using something called rootsh. This tutorial titled: How to track Linux Shell Users activity? covers it too.

rootsh: bad characters in arguments

In these types of scenarios, you'll likely have to ssh to the server and then copy/paste the public portion of your SSH key-pair into the user account's $HOME/.ssh/authorized_keys file by hand.

NOTE: your SSH key will typically be here on your local system: ~/.ssh/id_rsa.pub. So open it in an editor, copy it to your clipboard, then ssh to the remote server and open the authorized_keys file (above) and paste the clipboard into it and save it.

| improve this answer | |
  • That's exactly the trick! It works like a charm! – Alessandro C Aug 3 '18 at 9:16
0

Try the following command:

cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys

| improve this answer | |
  • I tried also that command but it returns the same error. I solved with @slm suggest – Alessandro C Aug 3 '18 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.