[Erlang crisis] (4.3) SSH Daemon

Source: Internet
Author: User

original articles, reproduced please specify the Source: Server non-amateur research http://blog.csdn.net/erlib author Sunface Contact e-mail: [Email protected]
SSH Daemon

ERLANG/OTP comes shipped with an SSH implementation that can both act as a server and a client. Part of it was a demo application providing a remote shell working in ERLANG.
to get the usually need to has your keys to has access to SSH stuff remotely on place already, but for Qu Ick test purposes, you can get the things working by DOING:

? ERLANG/OTP comes with an SSH implementation, which can be a server or a client. Part of the implementation of SSH is the demo demo of the remote shell in Erlang.
To make it work, you usually need to deploy your SSH on a remote server. But because we're just doing experiments, we can do this like this:

-----------------------------------------------------------------------------------
$ mkdir /tmp/ssh
$ ssh-keygen -t rsa -f /tmp/ssh/ssh_host_rsa_key
$ ssh-keygen -t rsa1 -f /tmp/ssh/ssh_host_key
$ ssh-keygen -t dsa -f /tmp/ssh/ssh_host_dsa_key
$ erl
1> application:ensure_all_started(ssh).
{ok,[crypto,asn1,public_key,ssh]}
2> ssh:daemon(8989, [{system_dir, "/tmp/ssh"},
2> {user_dir, "/home/ferd/.ssh"}]).
{ok,<0.52.0>}
-----------------------------------------------------------------------------------

I ' ve only set a few options here, namely System_dir, which was where the host files are, and User_dir, which contains S SH configuration files. There is plenty of other options available to allow for specific passwords, customize handling of public keys, and so on 3.

? I set a few options above, specifying the system directory (SYSTEM_DIR) that holds the host file, specifying the user directory (User_dir) that contains the SSH profile. There are a number of other options: setting a specific password, customizing the public key ) et cetera 3.

to connect to the daemon, any SSH client would do:

? Any SSH client can connect to this daemon (daemon) with the following code:

-----------------------------------------------------------------------------------
$ ssh -p 8989 [email protected]
Eshell Vx.x.x (abort with ^G)
1>
-----------------------------------------------------------------------------------
And with this can interact with an Erlang installation without have it installed on the current machine. Just disconnecting from the SSH session (closing the terminal) would be enough to leave. Do not run functions such as Q () or init:stop (), which'll terminate the remote host.4

so you don't have to install Erlang locally and use the other node's Erlang. After you disconnect the SSH session directly (close the terminal) you can safely leave. However, you must not output the command 4for terminating the remote shell, such as Q () or init:stop (). (Remember to connect to the remote node directly, you cannot call Q () or init:stop ()-Sunface)

If you had trouble connecting, you can add the-ologlevel=debug option to SSH to get DEBUG output.

? If SSH cannot be connected successfully, you can add an option-ologlevel=debug to SSH and then output the DEBUG information.

[3] Complete instructions with all options to get the set up is available Athttp://www.erlang.org/doc/man/ssh.html#daemo N-3.
[4] This is true for all methods of interacting with a remote Erlang node.

[Note 3]: For a description of all options see: Http://www.erlang.org/doc/man/ssh.html#daemon-3.
[Note 4]: This command does not work for all methods that connect remote Erlang nodes!

[Erlang crisis] (4.3) SSH Daemon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.