The main types of remote online servers at present:
Text interface clear code: telnet, rsh, etc. are mainly used, and are rarely used at present;
Text interface password: ssh is the main method, which has replaced the above-mentioned telnet, rsh and other clear code methods;
SSH:
In the default state, it provides two service functions:
One is a remote online server similar to telnet using shell, that is, the so-called ssh
The second is sftp-server, which is similar to the FTP service, providing a more secure FTP service
Start the SSH service :
/etc/init.d/sshd restart (all services in the /etc/init.d directory can use service )
ssh [-f] [-o parameter item ] [-p irregular port ] [ account @]IP [ command ]
-f : Send a command directly without logging in to the remote host
-o : Parameter items: The main parameter items are:
ConnectTimeout= seconds : the number of seconds to wait for online, reduce the waiting time
StrictHostKeyChecking=[yes|no|ask] : The default is ask , if you want publickey to actively join known_hosts , you can set it to no .
-p : Use this item if your sshd service is started on a non-regular port (22) ;
[ Command ] : Send commands directly without logging in to the remote host.
Simulate the file transfer method of FTP: sftp ---- upload/download files (do not know the file name on the server)
Commands used by the sftp interface:
(1) Behavior against the remote server host
(2) For native behavior (prefix the command with a lowercase l)
Commands used by the sftp interface
Note: sftp cannot recursively copy directories
Copy files directly from different places: scp --- already know the file name of the file on the server
# scp [-pr][-l rate ] file [ account @] host : directory name - à copy to remote
# scp [-pr] [-l rate ] [ account @] host : file directory name - à remote copy to this machine
example:
(1) Copy all the /etc/hosts* of this machine to the studenthome directory above 127.0.0.1
# scp /etc/hosts* [email protected]:~
[email protected]'s password:
hosts 100% 207 0.2KB/s 00:00
hosts.allow 100% 161 0.2KB/s 00:00
hosts.deny 100% 347 0.3KB/s 00:00
Each line shows the content:
File name display progress capacity (bytes) transfer speed remaining time
(2) Copy the /etc/bashrc of the remote host 127.0.0.1 to the /tmp of the local machine
# scp [email protected]:/etc/bashrc /tmp
(3) If you want to copy the directory, you can add the -r option
# scp [email protected]:/home/wangrujie/Music/* .