且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法使用Elixir连接到远程SSH服务器

更新时间:2023-01-22 10:10:13

如果我们查看 :ssh.connect / 3 $ c的文档$ c> 我们看到 host 参数应该是一个字符串。由于是erlang函数的文档,因此字符串表示字符列表。单引号创建字符列表字符串,双引号创建utf-8编码的二进制字符串。改为这样调用函数::ssh.connect('my.server.co.uk',22,用户:'my_username')

If we look at the documentation for :ssh.connect/3 we see that the host argument should be a string. Since it's documentation for an erlang function the string means a charlist. Single quotes creates charlist strings, double quotes create utf-8 encoded binary strings. Call the function like this instead: :ssh.connect('my.server.co.uk', 22, user: 'my_username').