login(options, password = nil) public

Login to the host with a given username and password.

The username and password can either be provided as two string arguments in that order, or as a hash with keys “Name” and “Password”.

This method looks for the strings “login” and “Password” from the host to determine when to send the username and password. If the login sequence does not follow this pattern (for instance, you are connecting to a service other than telnet), you will need to handle login yourself.

The password can be omitted, either by only provided one String argument, which will be used as the username, or by providing a has that has no “Password” key. In this case, the method will not look for the “Password:” prompt; if it is sent, it will have to be dealt with by later calls.

The method returns all data received during the login process from the host, including the echoed username but not the password (which the host should not echo). If a block is passed in, this received data is also yielded to the block as it is received.

Show source
Register or log in to add new notes.