OpenSSH has been added to Windows (as of autumn 2018), and is included in Windows Server and Windows client. OpenSSH is the open-source version of the Secure Shell (SSH) tools used by administrators of Linux and other non-Windows for cross-platform management of remote systems. If you liked this post about ten useful SSH commands in Linux, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below.Applies to Windows Server 2022, Windows Server 2019, Windows 10 (build 1809 and later) If you find it difficult to understand the basic SSH commands, you can always contact our technical support, and they will help you with this. In this tutorial, we explained the ten most used SSH commands in Linux. Restart SSH ServiceĪfter some changes in the SSH configuration, we need to restart the SSH service for the changes to take effectivity. Open the file /etc/ssh/sshd_config with your favorite editor and find the line that contains the Port 22Ĭhange the port number to 6622 for example. This is not an SSH command but is very relatable to the SSH service itself. This command will copy the file to the /var/www/html directory on a server running on port 7022 9. This command is often used when there is some website migration over two different servers.įor example, to copy the html directory from one to another server running on port 7022, execute the command below: rsync -Waq -e 'ssh -p 7022' /var/"IP address of the other server":/var/www/html/ SHA256:j/jQn0W8CrxJdR5NHcfTn9zDTmlANj4dn9QRlljNzWE Your public key has been saved in /root/.ssh/id_rsa.pub Your identification has been saved in /root/.ssh/id_rsa :~# ssh-keygenĮnter file in which to save the key (/root/.ssh/id_rsa):Įnter passphrase (empty for no passphrase): Once done, you should receive an output similar to this. The system will ask you where to store the keys, about the passphrase, and confirm the passphrase. Now, you can generate SSH keys with extra security using the command below: ssh-keygen First, create the directory for the SSH keys. To generate SSH key pairs, follow the steps below. You should receive an output similar to this :~# ssh -V To check the SSH client version, execute the following command: ssh -V We assume that we covered the most used cases for login to the server, so now will proceed with the SSH commands that are executed on the server. The key file can be located on your server, and you can log in to another server as well. Executing the ssh command is with specifying the location of the key file and specifying the user that file has permission for. In this case, the user has the key file somewhere locally on his computer. It is up to the user if he wants to specify or not the default port 22 in the command. In most cases, those users have shared hosting plans or are developers who have limited access to the server. Log in to Server with a non-root UserĬlients who do not have full root access to the server can only log in with their username. This is a scenario where the SSH port is changed due to security reasons, and the SSH will be accessible only on that port. This scenario is used by the clients who have full root access to their servers provided by the hosting company. Log in to Server with root User, password, and custom port In most cases, this command is used on the hosts with multiple virtual private servers in other words, with virtualization. In this case you will log in to the server on the default port 22, where the access is granted. To login to the server with the root user, execute the following command: ssh Once the system is updated, we can start with the most 10 used SSH commands in Linux.
0 Comments
Leave a Reply. |