ssh stands for “Secure Shell”. It is a protocol used to securely connect to a remote server/system. ssh is secure in the sense that it transfers the data in encrypted form between the host and the client. It transfers inputs from the client to the host and relays back the output. ssh runs at TCP/IP port 22.
How can we access Ubuntu or Red hat Linux machine via the Windows command prompt using `ssh`?
By using shh:
For example: If our IP address is “10.143.90.2” and username is “Jayesh”
Add your username in place of “Jayesh” and add your IP address in place of “10.143.90.2”
ssh to linux system from windows
command consists of 3 different parts:
- ssh command instructs the system to establish an encrypted secure connection with the host machine.
- user_name represents the account that is being accessed on the host.
- host refers to the machine which can be a computer or a router that is being accessed. It can be an IP address (e.g., 192.168.1.24) or domain e.g., www.domainname.com).
Note: After logging into the host computer, commands will work as if they were written directly to the host terminal. Using a public-private key pair or SSH key pair to login into the remote host is more secure as compared to using passwords.
For generating public-private keys use the command:
The private key must remain hidden while the public key must be copied to the remote host. After copying the public key to the remote host, the connection will be established using SSH keys and not the password.
Options available in ssh
Note: Here instead of user and host add username and IP address you want to connect to. And localhost is IP of our local system.
|| Forces ssh to use protocol SSH-1 only.
ssh -1 user@host
|| Forces ssh to use protocol SSH-2 only.
ssh -2 user@host
||Allows IPv4 addresses only.
ssh -4 user@host
||Allows IPv6 addresses only.
ssh -6 user@host
||Authentication agent connection forwarding is enabled.
ssh -A user@host
||Authentication agent connection forwarding is disabled.
ssh -a user@host
||Compresses all data (including stdin, stdout, stderr, and data for forwarded X11 and TCP connections) for a faster transfer of data.
ssh -C user@host
||Selects the cipher specification for encrypting the session. Specific cipher algorithm will be selected only if both the client and the server support it.
ssh -c aes256-cbc user@host
||Requests ssh to go to background just before command execution.
ssh -f user@host command
||Allows remote hosts to connect to local forwarded ports.
ssh -g -L 8080:localhost:80 user@host
|| Prevents reading from stdin.
ssh -n user@host command
|| Port to connect to on the remote host.
ssh -p 2222 user@host
||Suppresses all errors and warnings
ssh -q user@host
||Display the version number.
|| Verbose mode. It echoes everything it is doing while establishing a connection. It is very useful in the debugging of connection failures.
ssh -v user@host
||Enables X11 forwarding (GUI Forwarding).
ssh -X user@host
The three major encryption techniques used by SSH.
SSH is significantly more secure than the other protocols such as telnet because of the encryption of the data. There are three major encryption techniques used by SSH:
- Symmetrical encryption: This encryption works on the principle of the generation of a single key for encrypting as well as decrypting the data. The secret key generated is distributed among the clients and the hosts for a secure connection. Symmetrical encryption is the most basic encryption and performs best when data is encrypted and decrypted on a single machine.
- Asymmetrical encryption: This encryption is more secure because it generates two different keys: Public and Private key. A public key is distributed to different host machines while the private key is kept securely on the client machine. A secure connection is established using this public-private key pair.
- Hashing: One-way hashing is an authentication technique which ensures that the received data is unaltered and comes from a genuine sender. A hash function is used to generate a hash code from the data. It is impossible to regenerate the data from the hash value. The hash value is calculated at the sender as well as the receiver’s end. If the hash values match, the data is authentic.
Frequently asked questions about `ssh` command in Linux.
1) What does SSH stand for?
SSH stands for “Secure Shell”.
2) What is SSH used for?
SSH is used to securely connect to a remote system or server. It can be used to transfer data between two connected systems.
3) What port does SSH run on?
SSh runs at TCP/IP port 22.
4) How can we access a Linux Machine via the Windows command prompt using SSH?
We can access a Linux machine via the windows command by using SSH
5) How can we create public-private keys using SSH?
By using SSH by using the command
6) What are the options available in SSH?
(MENTIONED IN ABOUVE CONTEXT TABLE)
7) What are the three major encryption techniques used by SSH?
The three major encryption techniques used by SSH are:
- Symmetrical encryption
- Asymmetrical encryption
(Explained in above context)
SSH is a secure and widely used protocol for accessing and managing remote servers or systems. The SSH command has many options for a local system to connect to the remote system (all discussed above). We have discussed the three types of major encryption techniques used by SSH – symmetrical, asymmetrical and hashing encryption. Overall, we can say that it is very important for one to know the working og SSH so that he/she can perform secured management of remote systems.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!