TIdRexec
This class implements Remote Execution (Rexec) as a client.
Unit
Description
This class implements Unix Remote Execution (Rexec) as a client. The Rexec protocol is sometimes used to run tasks from remote locations while requiring password authentication. This protocol was originally intended as a temporary "hack" in some older Berkeley Unix Distributions that came into wide usage.
Note that while this protocol is a little more secure than RSH, it still can pose a security hazard on the Internet because the User ID and password are sent in plain-text and that can easily be intercepted by someone wanting to run destructive program.
To use this component:
- Set the TIdRexec.Host to the I.P. Address or name of the remote machine.
- Set the TIdRexec.UserName to the user's remote User ID
- Set the TIdRexec.Password to the user's password
- Use the TIdRexec.Execute method with the command to run on the remote machine
Account authorization used for the connectiong to the remote host.
Description
Password is a String property that represents the account authorization used for the connectiong to the remote host.
Username and Password are used for authentication of the connection when the
Execute method is called.
Port number for the connection to the Rexec server.
Description
Port is an Integer property that identifies the port number for connecting to an Rexec server. The default value for Port is
Id_PORT_exec which is commonly used for the Rexec protocol. Port is updated in the
Create method.
Account identification used for connecting to the remote host.
Description
Username is a String property that represents the account identification used for connecting to the remote host. Username and
Password are used for authenticating the client connection when the
Execute method is called.
constructor Create(AOwner: TComponent); override;
Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create
Create constructs a properly initialized instance of TIdRexec using the inherited Create constructor, and initializes Port to the constant value Id_PORT_exec (Decimal 512) as required by the Rexec Protocol.
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 Rexec Deamon with the TIdExec.UserName and the
TIdRexec.Password and than executes a command (ACommand) on the Rexec 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 Rexec Deamon. The inherited TIdRemoteCMDClient.UseStdError property effects how error messages are sent from the Rexec Deamon.