The Linux development environment constructs and uses the--linux essential software ssh

Source: Internet
Author: User
Tags file copy ssh server

SSH is the abbreviation for secure Shell, developed by the IETF Network Working Group, and SSH is a security protocol based on the application layer and transport layer.


SSH is currently a more reliable protocol that provides security for Telnet sessions and other network services. often used for remote logins, and for copying data between users.


The use of SSH protocol can effectively prevent the information leakage in the remote management process. SSH was originally a program on a UNIX system, and later expanded quickly to other operating platforms. SSH can compensate for vulnerabilities in the network when it is used correctly. The SSH client is available on a variety of platforms. Almost all UNIX platforms-including HP-UX, Linux, AIX, Solaris, Digital UNIX, Irix, and other platforms-can run SSH.


Installation of related tools

Installation of the SSH server:

sudo apt-get install Openssh-server


Installation of the SSH client:

sudo apt-get install openssh-client


client-server relationship : If a machine wants to be remotely controlled by a B machine, a machine needs to install an SSH server, and the B machine needs to install an SSH client.


If there is a problem with the process, you can restart the SSH server:

sudo service ssh restart


Test using

Operation command:ssh-l username HostIP

ssh : command

- l : option is the letter "L", not the number "1"

username: User name for Telnet

hostip: The IP address that was Telnet


To view the IP that is remotely remote:



telnet ( here is the user Wencong (A machine) remote login edu (B machine) ), can not use sudo :



SSH tells the user that this host is not recognized, then type "yes", SSH will be related to the information, written "~/.ssh/know_hosts", again access, there will be no such information . Then after entering the password, you can log on to the host.


Next, prompt to enter the login password:



Login success:





If you want to telnet to Linux under the Windows platform, Windows needs to install the Xmanager package.

Xmanager is a software package. Includes Xshell, Xftp, Xstart and other software.

Xshell: is an ssh, TELNET, and RLOGIN terminal software under the Windows platform. It makes it easy and secure for users to access Unix/linux hosts on the Windows platform.

Xftp: is an FTP and SFTP file transfer program that is applied to the Windows platform. Xftp can safely transfer files between Unix/linux and Windows platforms.

Xstart: Allows remote access to the server using the graphical interface, but is slightly less efficient and supports only the GNOME desktop.


Here, we use Xshell software, for details, see: "Build and use the Linux development environment--connect Ubuntu remotely via Xshell."


SSH Configuration

SSH installation, there is no default user profile, we can according to their own needs to configure.


As the above example, we have to log on to the Edu user on 10.221.20.16, we have to knock "ssh-l edu 10.221.20.16" every time.


Here's how to simplify this command.

To create a file config under ~/.ssh:



Write the following in config :



Later, you can log on to the EDU user on the 10.221.20.16 by running SSH edu on the command line:



Note: The first line of config, if you change to Host *test , the command becomes:SSH test. The name of test is customized according to the need, and the match on the name is OK .




Of course, there are more other options, such as Forwardagent, Compression, ForwardX11 Fallbacktorsh, etc., here is not listed.


Copy files and directories with "SCP"

SSH provides a number of commands and shells used to log on to the remote server. By default, users are not allowed to copy files, but an "SCP" command is provided, using the following method:


Local files are copied to remote:
SCP FileName [Email protected]:remotefile
SCP FileName Remotehostip:remotefolder
SCP FileName Remotehostip:remotefile

Local directory replication to remote:
Scp-r FolderName [Email protected]:remotefolder
Scp-r FolderName Remotehostip:remotefolder

Remote file copy to Local:
SCP [Email Protected]:remotefile FileName
SCP Remotehostip:remotefolder FileName
SCP Remotehostip:remotefile FileName

Remote directory replication to Local:
scp-r [Email Protected]:remotefolder FolderName
Scp-r Remotehostip:remotefolder FolderName


Only one command is tested here, and the other operations are similar.

Remote file copy to Local:

SCP [Email Protected]:remotefile FileName

remoteusername: remote user name

remotehostip: Remote IP

remotefile: Remote file, can take path

FileName: Copy to local name, can take path, copy to current directory without path


To view remote directories and files:



To view local directories and files:



To copy remote files:




Copying a remote file can modify its name arbitrarily:



Copying remote files allows you to specify a storage path:



The Linux development environment constructs and uses the--linux essential software ssh

Related Article

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.