OSX上的scp不允许在用户名中使用空格吗? [英] scp on OSX doesn't allow spaces in usernames?
问题描述
我需要进入运行 MobaSSH 作为其SSH守护进程的Windows 7盒,并在其中使用用户名Windows框中包含一个空格.我可以这样登录OSX终端上的Windows 7框:
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
所以我以为我可以在OSX上使用scp命令在计算机之间传输文件,但是每次执行以下操作时,我总是收到一条错误消息,提示无效的用户名":
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.
我确实发现在特定版本的scp中发布了有关此问题的错误,但我不确定如何在OSX上修补scp.该补丁以.c文件的形式提供.
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.
我的最后一招是在Windows 7框中创建一个新的用户名,并将我的所有配置文件设置转移到该新用户.鉴于我可以通过ssh登录,但不能通过scp登录,这似乎很麻烦.
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.
有什么提示吗?
推荐答案
通常在〜/.ssh/config
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
我刚刚在OS X 10.7(Lion)上进行了尝试,它可以在一台Mac上运行到另一台Mac,而其他选项(带引号或转义的转义字符)没有....就是这样.
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.
这篇关于OSX上的scp不允许在用户名中使用空格吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!