* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
, from which it is derived, and uses the rcmd() facility implemented in RCommandClient to implement the functionality of the rlogin command that first appeared in 4.2BSD Unix. rlogin is a command used to login to a remote machine from a trusted host, sometimes without issuing a password. The trust relationship is the same as described in the documentation for
As with virtually all of the client classes in org.apache.commons.net, this
class derives from SocketClient. But it relies on the connection
methods defined in RcommandClient which ensure that the local Socket
will originate from an acceptable rshell port. The way to use
RLoginClient is to first connect
to the server, call the
fetch the connection's input and output streams.
Interaction with the remote command is controlled entirely through the
I/O streams. Once you have finished processing the streams, you should
to clean up properly.
The standard output and standard error streams of the
remote process are transmitted over the same connection, readable
from the input stream returned by
. Unlike RExecClient and RCommandClient, it is
not possible to tell the rlogind daemon to return the standard error
stream over a separate connection.
will always return null.
The standard input of the remote process can be written to through
the output stream returned by
getInputStream(). Disconnecting from the server or closing the process streams before reaching end of file will terminate the remote login shell in most cases.
If user authentication fails, the rlogind daemon will request that a password be entered interactively. You will be able to read the prompt from the output stream of the RLoginClient and write the password to the input stream of the RLoginClient.
localUsernameThe user account on the local machine that is trying to login to the remote host.
remoteUsernameThe account name on the server that is being logged in to.
terminalTypeThe name of the user's terminal (e.g., "vt100", "network", etc.)
terminalSpeedThe speed of the user's terminal, expressed as a baud rate or bps (e.g., 9600 or 38400)
java.io.IOExceptionIf the rlogin() attempt fails. The exception will contain a message indicating the nature of the failure.