1

我正在尝试使用 Vim 编辑远程服务器上的一些文件。我过去曾在其他服务器上毫无问题地管理过这个,但在这种情况下,当我输入:

$ vim ftp://username@xxxxxx.com/

系统提示我输入密码,我输入密码并看到:

Name (notixvalet.com:george): User cannot log in. 
Please login with USER and PASS. 
Please login with USER and PASS. 
Please login with USER and PASS. 
ftp: Login failed 

'george' 是我在本地机器(Mac OS X 10.8)上的用户名。无论我做什么,Vim 似乎都忽略了我给它的用户名并试图以 'george' 身份登录。为了测试这一点,我在我的 MacBook 上创建了一个新帐户,其用户名与我尝试登录的服务器上的用户名相同,然后我可以从该帐户正常登录。这显然是一个非常 hacky 的解决方案 - 我如何使用我的常规帐户中的正确用户名进行连接?

(顺便说一句,我使用的用户名和密码 100% 绝对正确 - 我可以使用它们通过 FileZilla 等 FTP 客户端连接到服务器。)

4

1 回答 1

1

netrw正如 Ingo 在评论中指出的那样,您用于编辑远程文件的插件是。您可以通过:h netrw. 特别是:

  NETRC                         *netrw-netrc*

  The <.netrc> file, typically located in your home directory, contains lines
  therein which map a hostname (machine name) to the user id and password you
  prefer to use with it.

  The typical syntax for lines in a <.netrc> file is given as shown below.
  Ftp under Unix usually supports <.netrc>; ftp under Windows usually doesn't.
  >
     machine {full machine name} login {user-id} password "{password}"
     default login {user-id} password "{password}"

  Your ftp client must handle the use of <.netrc> on its own, but if the
  <.netrc> file exists, an ftp transfer will not ask for the user-id or
  password.

     Note:
     Since this file contains passwords, make very sure nobody else can
     read this file!  Most programs will refuse to use a .netrc that is
     readable for others.  Don't forget that the system administrator can
     still read the file!  Ie. for Linux/Unix: chmod 600 .netrc

您是否有可能忘记从可以毫无问题地连接的其他服务器复制 ~/.netrc 文件?或者它具有不正确的权限,如上一段所述?

于 2013-06-24T16:27:54.427 回答