Linux SSH command instance Guide

Source: Internet
Author: User

Linux SSH command instance Guide

If you have been in the IT circle for a long time, you should have heard about SSH, a great tool and its security features. this tutorial allows you to quickly learn how to securely and conveniently connect to a remote computer through SSH.

If you have no idea about SSH, visit Wikipedia first.

How to Improve the SSH login authentication speed of Ubuntu

Enable the SSH service to allow Android phones to remotely access Ubuntu 14.04

How to add dual authentication for SSH in Linux

Configure the SFTP environment for non-SSH users in Linux

Configure and manage the SSH service on Linux

Basic SSH tutorial

Basic usage

You only need to specify the username and host name parameters for the simplest SSH command. The host name can be an IP address or domain name. The command format is as follows:

  1. $ Ssh user @ hostname

For example, to log on to a Raspberry Pi system in my LAN, simply enter the following command in the command line:

  1. $ Ssh pi@10.42.0.47.

In the command, pi and 10.42.0.47 are the usernames and lan ip addresses of my Raspberry pi system. In actual use, the host name must be changed to the IP address of your target host (LAN or remote.

If you can log on successfully, the following content is easy for you.

Use other ports

SSH is connected to port 22 of the target host by default, but you may need to connect to other ports for various reasons.

  1. $ Ssh-p 10022 user @ hostname

The above command is to add the parameter-p to specify the port number as 10022.

Remote Command Execution

Sometimes it is convenient to execute a command on the remote host and display it locally, and then continue working locally. SSH can meet this requirement:

  1. $ Ssh pi@10.42.0.47 ls-l

For example, the above command will enumerate the content of the remote host's main directory and display it locally. Isn't it cool? You can try other commands.

Mount a Remote File System

Another great SSH-based tool, sshfs. sshfs, allows you to directly mount the file system of the remote host locally.

  1. $ Sshfs-o idmap = user @ hostname:/home/user ~ /Remote

For example, the following command:

  1. $ Sshfs-o idmap = user pi@10.42.0.47:/home/pi ~ /Pi

This command mounts the Home Directory of the remote host pi user to the Pi folder under the local home directory.

For more information, see the sshfs tutorial.

X11 graphic interface

If you want to run a graphic interface program on the remote host, SSH will help you think of it! You can use the SSH basic command and the parameter-X to connect to the remote host to enable the X11 forwarding function. after logging on, you may feel that there is no difference, but when you run a graphic interface program, you will find that there are different.

  1. $ Ssh-X pi@10.42.0.47
  2.  
  3. $ Pistore

If you want to do something else while running the graphic interface program, simply add an & symbol at the end of the command.

  1. $ Pistore &

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.