How to Remote Login to a Mac in Active Directory

I started to join our Macs to Active Directory and test them. One issue came up. Can I use a network account to remote login? Here is what I found out.

If you have logged on to the machine before, you can just use the following to remote login.

ssh [email protected]

If you have NOT logged on to the machine before, you need to include the domain name in the command.

ssh 'domainname\[email protected]

Note that you have to enclose domain name and user name combination with single quote.