Reputation: 2957
I need to ssh into a Windows 7 box running MobaSSH as its SSH daemon, and the username on the Windows box contains a space. I can login to the Windows 7 box on an OSX terminal like so:
ssh "Some User"@WindowsHost
So I thought I'd be able to use the scp command on OSX to transfer files between the computers, but I keep getting an error saying "invalid username" whenever I do something like this:
scp myfile "Some User"@WindowsHost:~/myfile
I looked into it and found this question on stackoverflow, but that is mainly about a space within the file paths.
I did find a bug posted about this issue in a specific version of scp, but I'm not sure how to patch scp on OSX. The patch is offered as a .c file.
My last resort is to create a new username on the Windows 7 box and transfer all my profile settings to that new user. It seems like a real hassle given that I can login via ssh, but not scp.
Any tips?
Upvotes: 8
Views: 8628
Reputation: 988
Replace the spaces with underscores:
scp file "User Name@host":
becomes
scp file User_Name@host:
Working with scp
from Linux to Mac OS X.
Upvotes: 0
Reputation: 2998
Add a special configuration to your Mac user's ssh config, usually in ~/.ssh/config
Host mySpaceyUsernameHost
User "Some User"
HostName WindowsHost
You should then be able to scp your file using that named configuration:
scp myfile mySpaceyUsernameHost:~/myfile
I just tried this on OS X 10.7 (Lion) and it worked from one Mac to another, whereas the other options (quoted, or backlash-escaped) did not.... so that's something.
Upvotes: 10
Reputation: 3049
Have you tried Some\ User@WindowsHost
? The escaped space may work unless there is actually a bug in scp.
Alternatively could you not just change the widows 7 username and remove the space?
Upvotes: 4