Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use the rexec command in Linux

Shulou Source: shulou.com Published: 2022-06-01 18:01:59 10月05日 Update

This article mainly shows you "how to use the rexec command in Linux". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn how to use the rexec command in Linux.

Linux common commands rexec commands are used to execute commands on a designated remote Linux system host and send requests to remote rexec servers to execute commands.

Rexec remotely executes commands under Linux system

Add that the rexec command provides automatic login by checking the $HOME/.netrc file, which contains the user name and password used on the remote host. If no such items are found or if the system operates in a secure mode (see the securetcpip command), the rexec command prompts for a valid user name and password for a remote host. In both cases, rexec causes rexecd on the remote system to use the default compat user login authentication method. Rexecd does not look for the / etc/security/user file for an alternate authentication method. You can also specify the-n flag to reset the automatic login function on the rexec command line.

Syntax rexec (option) (parameter) option-a: indicates that the standard error of the remote command is the same as the standard output and does not support sending any signal to the remote process;-l: specify the user name to connect to the remote rexec server;-p: specify the password to connect to the remote rexec server;-n: explicitly prompt for the user name and password. Parameter remote host: specify the remote host (ip address or hostname)

Commands: specify the commands that need to be executed on the remote host.

To execute the date command on a remote host, enter:

The output of the rexec host1 datedate command is now displayed on the local system. In this example, the $HOME/.netrc file on the local host contains a valid user name and password on the remote host. If there is no valid entry in the $HOME/.netrc file of the remote host, you will be prompted for the login ID and password. After entering the required login information, the output of the date command is displayed on the local system.

To reset the automatic login function and execute the date command on the remote host, enter:

Enter the user name and password when prompted by rexec-nhost1 date, and the output of the date command is now displayed on the local system.

List the directory of another user on the remote host and enter:

The directory list of rexec host1 ls-l / home/karen karen users on the remote host host1 is displayed on the local system.

If there is no valid entry in the $HOME/.netrc file of the remote host, you will be prompted for your login ID and password. After entering the required login information, the directory list of karen users on the remote host host1 is displayed on the local system.

The above is all the contents of the article "how to use rexec commands in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Command host user input system password login user name file prompt valid output content function server directory article service information parameter Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info vpn Shulou Technology MariaDB NVidia