Ubuntu does not have the ssh service installed by default. You can run the following command:

[email protected]:~ $ssh localhost
ssh:connect to host localhost port 22:connection refused

As shown above, it means that ssh has not been installed.

Install via apt-get as follows:

[email protected]:~ $sudo apt-get install openssh-server

The default port of ssh is 22. You can modify the default port by sudo /etc/init.d/ssh start.

scp logs in based on ssh, so file copying cannot be performed without ssh installed.

The use of scp is quoted from ():

There are three common methods for copying files between different linuxs. The first is ftp, which is one of which installs ftpserver, so that another one can use ftp client program to copy files. The second method is to use samba service, similar to the operation of the windows file copy,More concise and convenient,The third is to use the scp command to copy files.

scp is a file copy with security and login based on ssh. It is more convenient to operate,For example, to copy the current file to another remote host,Can be ordered as follows.

scp /home/daisy/full.tar.gz [email protected]:/home/root

Then you will be prompted to enter the login password of the root user of the other host,Then started copying.

If i want to do the reverse,Copy files from the remote host to the current system,It's also very simple.

scp [email protected]:/home/root /home/daisy/full.tar.gz
  • Previous ASPNET MVC5 Website Development Article Management Architecture (7)
  • Next C # socket communication usage examples