Reputation: 441
I am a newbie to erlang and would like to know how to get ssh connection to a remote machine A and transfer files using ssh .Any help would be really appreciated.I have allready searched in other forums regarding the same but could not understand the code
Upvotes: 0
Views: 376
Reputation: 8340
1> ssh:start().
ok
2> {ok, Pid, ConnRef} = ssh_sftp:start_channel("my.server.com").
{ok,<0.52.0>,<0.47.0>}
3> ssh_sftp:list_dir(Pid, ".").
{ok,[".login",".bash_history",".login_conf",".profile",".rhosts",".lesshst",".ssh","some","other","files",".shrc","..","."]}
4> {ok, Data} = ssh_sftp:read_file(Pid, ".login").
{ok,<<"# $FreeBSD: release/10.0.0/share/skel/dot.login 190477 2009-03-27 21:13:14Z ru $\n#\n# .login - csh login scri"...>>}
Upvotes: 2