Indy 9 | Content | Index | Reference

TIdRSH
Hierarchy, Properties, Methods, Events, See Also, Unit: IdRSH
This class implements Unix Remote Shell (RSH) as a client.

    TIdRSH = class(TIdRemoteCMDClient)

Unit
IdRSH
Description
This class implements Unix Remote Shell (RSH) as a client. The RSH protocol is sometimes used to run tasks from remote locations without having to send passwords to a remote system. This protocol was originally intended as a temporary "hack" in some older Berkeley Unix Distributions that came into wide usage.

Note that this protocol can pose a security hazard on the Internet as it only uses user ID's which are sent in plain-text, IP Addresses that are used as part of the server authentication can be falsified, a port number restriction can easily be overcome by using a single-user operating system or by someone with administrative privileges on a multi-user operating system, and this protocol is not compatible with some firewall-proxy configurations.

To use this component:

- Set the TIdRSH.Host to the I.P. Address or name of the remote machine.

- Set the TIdRSH.ClientUserName to the user's local User ID.

- Set the TIdRSH.HostUserName to the user's remote User ID.

- Use the TIdRSH.Execute method with the command to run on the remote machine.

TIdRSH.ClientUserName
TIdRSH, See Also
This property is the user's current name on their machine.

    property ClientUserName: String;

Description
This property is the user's current name on their machine that will be sent to the RSH Deamon for authentication along with the TIdRSH.HostUserName whenever the TIdRSH.Execute method is called. For Windows RSH Clients, this is usually set with the value obtained with the GetUserName Win32 API function.

TIdRSH.HostUserName
TIdRSH, See Also
User ID on the remote host.

    property HostUserName: String;

Description
HostUserName is the uUser ID on the remote host. HostUserName is sent along with the local user name (IdRSH.ClientUserName) for authentication when the TIdRSH.Execute method is called.

TIdRSH.Port
TIdRSH, See Also
Port number for the RSH client connection.

    property Port: integer;

Description
Port is an Integer property that identifies the Port number for the RSH client connection. The default value for Port is IdPORT_cmd (514), as assigned in the constructor for the object instance.

TIdRSH.UseReservedPorts
TIdRSH
Indicates that connections are restricted to a fixed range of port numbers.

    property UseReservedPorts: Boolean;

Description
UseReservedPorts is a Boolean property that indicates if the RSH client is required to use a fixed range of reserved port numbers for connections to the RDH daemon. The default value for UseReservedPorts is IDRemoteFixPort, as assigned in the Create constructor.

TIdRSH.Create
TIdRSH, See Also
Instantiates a TIdRSH instance.

    constructor Create(AOwner: TComponent); override;

Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create constructs a properly initialized instance of TIdRSH using the inherited Create constructor, and initializes Port to the constant value IdPORT_cmd (Decimal 514) as required by the RSH Protocol.

TIdRSH.Execute
TIdRSH, See Also
This method executes a command (ACommand) on the RSH Deamon.

    function Execute(ACommand: String): String; override;

Parameters
ACommand: String
The command to execute on the remote system.
Return Value
String - The results from the command that was executed or no value if an error occurred.
Description
This method authenticates to the RSH Deamon with the TIdRSH.ClientUserName and the TIdRSH.HostUserName and than executes a command (ACommand) on the RSH Deamon. This is only intended for non-interactive processes where the no input is expected from the user.

If an error occurred, TIdRemoteCMD.ErrorReply is set to true and the TIdRemoteCMD.ErrorMessage contains the message returned from the RSH Deamon. The inherited TIdRemoteCMDClient.UseStdError property effects how error messages are sent from the RSH Deamon.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.