Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm connected to Ubuntu server that is a member of a corporate Active Directory domain via likewise-open. The users are in the form mydomain\myuser. I can connect to it via ssh, escaping the \ with another \:

ssh mydomain\\myuser@myserver

I've generated a pair of keys via ssh-keygen, then tried to copy it to the remote machine. The user I'm using in the local machine is not the same I want to copy the key into, so I issued the command:

ssh-copy-id mydomain\\myuser@myserver

and the output:

mydomainyuser@myserver's password:
Received disconnect from myserver: 2: Too many authentication failures for myuserydomain

prompting me for the local user's password three times, and then the \\ actually worked as a single \ escaping the first m in mydomain. Am I getting this straight? And how can I escape that \ and correctly copy key to the remote machine?

EDIT: also ssh-copy-id myuser@mydomain.com@myserver turned out to be a valid syntax.. However, the question was about escaping the \.

share|improve this question
up vote 3 down vote accepted

The reason this is happening is because you are escaping it for the shell, but ssh-copy-id is also attempting to interpret it. This should work:

ssh-copy-id 'mydomain\\myuser@myserver'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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