Linux rlogin Command with Practical Examples

LinuxLinuxBeginner
Practice Now

Introduction

In this lab, you will learn about the rlogin command, which is used to establish a remote login session to a different system over the network. The rlogin command allows you to execute commands and transfer files between the local and remote systems securely. You will start by checking the availability of the rlogin command on your system, then proceed to establish a remote login session and explore its capabilities, such as executing remote commands and transferring files.

The lab covers the following steps: Introduction to rlogin Command, Establishing Remote Login Session, and Executing Remote Commands and Transferring Files. This lab is part of the System Monitoring and Management skill set.

Linux Commands Cheat Sheet


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/BasicFileOperationsGroup(["`Basic File Operations`"]) linux(("`Linux`")) -.-> linux/RemoteAccessandNetworkingGroup(["`Remote Access and Networking`"]) linux/BasicFileOperationsGroup -.-> linux/ls("`Content Listing`") linux/RemoteAccessandNetworkingGroup -.-> linux/ssh("`Secure Connecting`") linux/RemoteAccessandNetworkingGroup -.-> linux/telnet("`Network Connecting`") linux/RemoteAccessandNetworkingGroup -.-> linux/scp("`Secure Copying`") subgraph Lab Skills linux/ls -.-> lab-422891{{"`Linux rlogin Command with Practical Examples`"}} linux/ssh -.-> lab-422891{{"`Linux rlogin Command with Practical Examples`"}} linux/telnet -.-> lab-422891{{"`Linux rlogin Command with Practical Examples`"}} linux/scp -.-> lab-422891{{"`Linux rlogin Command with Practical Examples`"}} end

Introduction to rlogin Command

In this step, you will learn about the rlogin command, which is used to establish a remote login session to a different system over the network. The rlogin command allows you to execute commands and transfer files between the local and remote systems securely.

First, let's check the availability of the rlogin command on your system:

which rlogin

Example output:

/usr/bin/rlogin

The output shows that the rlogin command is installed and available in the /usr/bin/ directory.

Next, let's try to establish a remote login session using the rlogin command. Assuming you have another system (or a Docker container) available, you can use the following command to connect to it:

rlogin remote_host

Replace remote_host with the hostname or IP address of the remote system you want to connect to.

Once you execute the command, you should be prompted to enter your username on the remote system. After providing the username, you will be logged in to the remote system, and you can start executing commands and transferring files between the local and remote systems.

To exit the remote login session, you can use the exit command.

exit

This will disconnect you from the remote system and return you to the local system's shell.

Establishing Remote Login Session

In this step, you will learn how to establish a remote login session using the rlogin command.

First, let's ensure that you have a remote system or Docker container available to connect to. For this example, let's assume the remote host has an IP address of 192.168.1.100.

To establish the remote login session, use the following command:

rlogin 192.168.1.100

You will be prompted to enter your username on the remote system. Provide the username and press Enter.

Once you're logged in, you should see the remote system's shell prompt. Now, you can start executing commands and transferring files between the local and remote systems.

For example, you can run the ls command on the remote system to list the contents of the current directory:

ls

Example output:

Documents  Downloads  Music  Pictures  Public  Templates  Videos

To exit the remote login session, use the exit command:

exit

This will disconnect you from the remote system and return you to the local system's shell.

Executing Remote Commands and Transferring Files

In this step, you will learn how to execute commands on the remote system and transfer files between the local and remote systems using the rlogin command.

First, let's establish a remote login session to the remote system:

rlogin 192.168.1.100

Enter your username when prompted.

Now, you can execute commands on the remote system directly from your local system. For example, let's run the uname -a command to get information about the remote system's operating system:

uname -a

Example output:

Linux remote_host 5.15.0-58-generic #64~20.04.1-Ubuntu SMP Fri Jan 6 16:49:16 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

To transfer a file from the local system to the remote system, you can use the rcp (remote copy) command. Let's create a file on the local system and then copy it to the remote system:

echo "This is a test file." > test_file.txt
rcp test_file.txt 192.168.1.100:/home/labex/

This will copy the test_file.txt from the local system to the /home/labex/ directory on the remote system.

To transfer a file from the remote system to the local system, you can use the same rcp command but reverse the source and destination:

rcp 192.168.1.100:/home/labex/test_file.txt ./

This will copy the test_file.txt from the remote system to the current directory on the local system.

When you're done, exit the remote login session using the exit command:

exit

Summary

In this lab, you learned about the rlogin command, which is used to establish a remote login session to a different system over the network. You started by checking the availability of the rlogin command on your system and then proceeded to establish a remote login session using the rlogin command. You were able to execute commands and transfer files between the local and remote systems securely. Finally, you learned how to exit the remote login session by using the exit command.

The lab provided a practical understanding of the rlogin command and its usage, equipping you with the knowledge to connect to remote systems and perform various tasks in a secure and efficient manner.

Linux Commands Cheat Sheet

Other Linux Tutorials you may like