
rlogin Command in Linux
The rlogin (remote login) command in Linux is a utility that allows users to log in to another host over a network. It provides a simple way to access a remote system and execute commands as if you were physically present at the terminal. rlogin is part of the Berkeley r-commands suite, which also includes rsh (remote shell) and rcp (remote copy).
This command allows users to establish a remote session on another machine, enabling them to execute commands and interact with the remote system as if they were physically present at the terminal. It is particularly useful for system administrators and users who need to manage or access multiple machines remotely.
Table of Contents
Here is a comprehensive guide to the options available with the rlogin command −
- Understanding rlogin Command
- Installation of rlogin Command
- Syntax of rlogin Command
- rlogin Command Options
- Examples of rlogin Command in Linux
- Advanced Usage of rlogin Command in Linux
Understanding rlogin Command
The rlogin command in Linux is used to log in to another host over a network using the Remote Login (rlogin) protocol. Despite its simplicity and ease of use, the rlogin command is considered insecure because it transmits data, including passwords, in plain text over the network. This makes it vulnerable to eavesdropping and man-in-the-middle attacks.
As a result, it is recommended to use more secure alternatives like ssh (Secure Shell) for remote login and command execution. ssh provides encrypted communication and better security features, making it a safer choice for remote access.
Installation of rlogin Command
The rlogin command is typically included in the rsh-client package. If it's not installed on your system, you can install it using your package manager. For example −
On Debian-based systems (like Ubuntu) −
sudo apt install rsh-redone-client

On Red Hat-based systems (like Fedora) −
sudo yum install rsh
Syntax of rlogin Command
The basic syntax of the rlogin command is rlogin [options] hostname, where hostname refers to the remote host you want to log in to. Some of the key options include -l to specify a different username, -8 to allow an eight-bit input data path, and -e to specify a different escape character.
The basic syntax of the rlogin command is as follows −
rlogin [options] hostname
Here, hostname refers to the remote host you want to log in to.
rlogin Command Options
Here are some important options you can use with rlogin −
Options | Description |
---|---|
-l username | Specify a different username for the remote login. |
-8 | Allow an eight-bit input data path at all times. |
-e char | Specify a different escape character. |
-L | Allow the rlogin session to be run in layout mode. |
-x | Enable DES encryption for all data passed via the rlogin session. |
Once connected, users can perform various tasks on the remote system, such as editing files, running scripts, and managing processes.
Examples of rlogin Command in Linux
The rlogin (remote login) command is a utility in Unix-like operating systems that allows a user to log in to another host over a network. It provides a simple way to access a remote system and execute commands as if you were physically present at the terminal. rlogin is part of the Berkeley r-commands suite, which also includes rsh (remote shell) and rcp (remote copy).
- Basic Remote Login
- Specifying a Different Username
- Allowing Eight-Bit Input Data Path
- Specifying a Different Escape Character
- Enabling DES Encryption
Basic Remote Login
To log in to a remote host called remotehost, use the following command −
rlogin remotehost

This command will prompt you for your password and then log you in to the remote host.
Specifying a Different Username
To log in to a remote host with a different username, use the -l option −
rlogin -l otheruser remotehost

This command will log you in to the remote host as another user.
Allowing Eight-Bit Input Data Path
To allow an eight-bit input data path at all times, use the -8 option −
rlogin -8 remotehost

This command will enable an eight-bit input data path for the rlogin session.
Specifying a Different Escape Character
To specify a different escape character, use the -e option −
rlogin -e ^ remotehost

This command will set the escape character to ^ for the rlogin session.
Enabling DES Encryption
To enable DES encryption for all data passed via the rlogin session, use the -x option −
rlogin -x remotehost

This command will enable DES encryption for the rlogin session.
Advanced Usage of rlogin Command in Linux
You can set up passwordless login using the .rhosts file. The .rhosts file should be placed in the home directory of the remote user and should contain the hostname and username of the local machine. For example, if you want to allow passwordless login from local machine as local user to remote host as remote user, add the to the .rhosts file in the home directory of remote user on remote host.
Ensure that the .rhosts file has the correct permissions −
chmod 600 ~/.rhosts

Now, you can login to remote host without being prompted for a password −
rlogin remotehost

Using rlogin in Scripts
You can use the rlogin command in shell scripts to automate remote login tasks. For example, create a script called remote_command.sh with the following content −
#!/bin/ # Script to execute a command on a remote host REMOTE_HOST="remotehost" REMOTE_USER="remoteuser" COMMAND="ls -l" rlogin -l $REMOTE_USER $REMOTE_HOST -c "$COMMAND"

Make the script executable −
sudo chmod +x remote_command.sh

Run the script to execute the command on the remote host −
The rlogin command provides a simple and efficient way to connect to remote systems without the need for complex configurations.
./remote_command.sh

This script will log in to the remote host as remote user and execute the specified command.
Security Considerations
The rlogin command is considered insecure because it transmits data, including passwords, in plain text over the network. It is recommended to use more secure alternatives like ssh (Secure Shell) for remote login and command execution. ssh provides encrypted communication and better security features.
I hope this detailed overview helps you understand the rlogin command and its usage.
Conclusion
The rlogin command is a useful tool for remote login to another host in Unix-like operating systems. By understanding its options and usage, you can effectively log in to remote systems and execute commands. However, due to security concerns, it is recommended to use more secure alternatives like ssh.
However, it is important to note that rlogin transmits data, including passwords, in plain text, making it less secure compared to modern alternatives like SSH (Secure Shell). Due to security concerns, rlogin is less commonly used today, but it remains a part of many Unix-like operating systems for compatibility and legacy support.