SSH Learning One of OpenSSH Basic Usage

  

On Linux systems, OpenSSH is currently the most popular remote system login and file transfer application, and is also a replacement for traditional Telenet, FTP and R series network applications. Among them, ssh (Secure Shell) can replace telnet, rlogin and rsh, scp (Secure Copy) and sftp (Secure FTP) can replace ftp.

OpenSSH uses a key to encrypt data to ensure data transmission security. Before the data is officially transmitted, the two parties first exchange keys, and when they receive the data of the other party, they use the key and the corresponding program to decrypt the data. This encrypted data transmission helps prevent illegal users from obtaining data information.

OpenSSH generates public and private keys in a random manner. The key is usually generated only once and can be recreated if necessary.

When using the ssh command to log in to a remote system, the OpenSSH server's sshd daemon will send a public key, and the OpenSSH client software ssh will prompt the user to confirm whether to receive the transmitted public key. At the same time, the OpenSSH client also sends back a key to the server, so that each system on both sides of the OpenSSH connection has the other party's key, thus being able to decrypt the encrypted data sent by the other party via the encrypted link.

The public and private keys of the OpenSSH server are stored in the /etc/ssh directory. On the OpenSSH client, all public keys received by the user and the IP address of the OpenSSH server providing the key are stored in the ~/.ssh/known_hosts file in the user's home directory (.ssh is a hidden directory). If the key does not match the IP address, OpenSSH will think that something is wrong. For example, reinstalling the operating system or upgrading OpenSSH will cause the system to generate new keys again, and malicious network attacks will also cause key changes. Therefore, when the key changes, you should always understand the reason for the key change to ensure data security during network access.

1 Installing OpenSSH Server

In Ubuntu, the OpenSSH client is installed as a base system software with this system, but the OpenSSH server needs to be installed separately. Install the openssh-server server package and use software tools such as apt-get, aptitude or synaptic.

$ sudo apt-get install openssh-server

After installation, you can use the following command to verify that the OpenSSH server's sshd daemon is enabled.

$ pidof sshd

2 Logging in to a remote system using SSH

In OpenSSH, ssh is an important client application. With ssh, you can log in to the remote system using encrypted communication. The syntax is as follows:

ssh [options] [-l login_name][user@]hostname [command]

The &lquo;-llogin_name” option is used to specify the username to indicate which user is logged in to the remote system. If you do not provide a username, log in to the remote system as the current user. For example, the following command form means to log in to the remote system as the webgod user with the default 22 port (note, here) Welcome to Ubuntu 12.04 LTS (GNU/Linux) ……https://helo.ubunut.com /” from /etc/motd file). In addition to the ”-l” option, in order to log in to the remote system as another user, you can also log in to the remote system using ”user@hostname”.

Copyright © Windows knowledge All Rights Reserved