Upload a download file to a Linux server by collecting 1. Scp
"Advantages" simple and convenient, safe and reliable; Support speed limit parameters
"Disadvantage" does not support exclude directories
Usage
The SCP is secure copy, which is used for remote file copying. The data transfer uses SSH and uses the same authentication method as SSH, providing the same security guarantee.
Command format:
SCP [parameters] < source address (user name @ip address or host name) >:< file path > < destination address (user name @IP address or hostname) >:< file path >
Example:
scp/home/work/source.txt [email protected]:/home/work/#把本地的source. txt files are copied to the/home/work directory on the 192.168.0.10 machine
SCP [email protected]:/home/work/source.txt/home/work/#把192. source.txt files on 168.0.10 machine are copied to the local/home/work directory
SCP [email protected]:/home/work/source.txt [Email protected]:/home/work/# Copy the Source.txt file on the 192.168.0.10 machine to the/home/work directory of the 192.168.0.11 machine.
Scp-r/home/work/sourcedir [email protected]:/home/work/#拷贝文件夹, plus-r parameter
Scp-r/home/work/sourcedir [Email protected]:/home/work/#使用主机名
Scp-r-v/home/work/sourcedir [email protected]:/home/work/#显示详情, plus-v parameter
2. rcp
The target host needs to open the RCP function in advance and set the RCP permissions: Add the source host to the list of trusted hosts, or you cannot use RCP to remotely copy files to the destination host on the source host.
Http://baike.baidu.com/view/611109.htm
3. wget
"Advantages" simple and convenient, support to exclude directories, support speed limit parameters
"Cons" can only download files or folders locally from a remote machine, and the remote machine needs to support FTP services (e.g. boot proftpd); more parameters, more complex than SCP
Usage
Wget is a free tool that automatically downloads files from the Web, supports downloads via HTTP, HTTPS, FTP three most common TCP/IP protocols, and can use HTTP proxies.
Command format:
wget [parameters] ftp://< the absolute path > #proftpd格式 of the target machine IP or host name >/< file
Example:
wget ftp://192.168.0.10//home/work/source.txt #从192. Copy folder on 168.0.10 source.txt
wget ftp://www.myhost.com//home/work/source.txt #使用主机名
Wget-nh-p/home/work/ftp://www.myhost.com//home/work/source.txt #指定本地保存路径, use the parameter "-P path" or "--directory-prefix= path" ;-nh,--no-host-directories do not create a host directory
Wget-r-L 0-nh-p/home/work/ftp://www.myhost.com//home/work/sourcedir #递归下载sourcedir目录, using parameter-r, parameter-L,--level=number most Large recursion depth (INF or 0 for Infinity).
wget--cut-dirs=3-r-L 0-nh-p/home/work/ftp://www.myhost.com//home/work/sourcedir #-parameter-cut-dirs=number ignore number layer remote Directory, this example saves the SourceDir directory on Myhost to the local work directory.
wget--limit-rate=200k--cut-dirs=3-r-L 0-nh-p/home/work/ftp://www.myhost.com//home/work/sourcedir #-parameter--limit-rat E=rate Limit Download Transmission rate
wget--limit-rate=200k--cut-dirs=3-r-L 0-nh-p/home/work/-x/home/work/sourcedir/notincludedir ftp://www.myhost.com Home/work/sourcedir #排除路径使用-X parameter
Wget-q--limit-rate=200k--cut-dirs=3-r-L 0-nh-p/home/work/-x/home/work/sourcedir/notincludedir ftp://www.myhost.c Om//home/work/sourcedir #参数-Q for Quiet mode, no output, default is-V, redundant mode
4. rsync
"Advantages" powerful, operation-like SCP, support to exclude directories, support speed limit parameters, also support local replication.
"Disadvantage" no
Usage
Rsync is a data-mirroring Backup tool under Unix-like systems, and--remote sync can be seen from the name of the software. It operates in the same way as the SCP and is much more powerful than the SCP. When using a double colon to split the hostname and file path, the rsync server is used, which is not described here.
Command format:
rsync [parameters] < source address (user name @ip address or host name) >:< file path > < destination address (user name @IP address or hostname) >:< file path >
Example:
rsync/home/work/source.txt [email protected]:/home/work/#把本地的source. txt files are copied to the/home/work directory on the 192.168.0.10 machine
rsync [Email protected]:/home/work/source.txt/home/work/#把192. source.txt files on the 168.0.10 machine are copied to the local/home/work directory
rsync [email protected]:/home/work/source.txt [Email protected]:/home/work/# Copy the Source.txt file on the 192.168.0.10 machine to the/home/work directory of the 192.168.0.11 machine.
Rsync-r/home/work/sourcedir [email protected]:/home/work/#拷贝文件夹, plus-r parameter
Rsync-r/home/work/sourcedir [Email protected]:/home/work/#使用主机名
Rsync-r-v/home/work/sourcedir [email protected]:/home/work/#显示详情, plus-v parameter
Rsync-r-v--exclude sourcedir/notinclude/home/work/sourcedir [email protected]:/home/work/#排除子目录, note: The path behind the--exclude cannot be an absolute path, it must be a relative path, otherwise it will not be ruled out.
5 Linux system with SSH login Management Server, and the SCP upload download files
To log in to the SSH method:
1. SSH Host
SSH 192.168.1.155 (means log on to the server with the root user)
2. SSH user @ Host
SSH [email protected] (means login to server with User1)
3, SSH host-l user name-p port
SSH 192.168.1.155-l user2-p 8080 (indicates that the User2 user connects to the 192.168.1.155 server with 8080 ports)
Uploading and downloading files using the SCP command
SCP [email protected]:1.txt 2.txt (download server 1.txt to local and rename to 2.txt)
SCP 2.txt [Email protected]:3.txt (Upload the local 2.txt file to the root directory of the server and name it 3.txt)
Scp-r words means uploading or downloading a folder
SCP-Indicates plus port information (p is uppercase)
6 WinSCP Software method (recommended)
Download install WINSCP under Windows, after running can see the remote Linux Server directory, select the file to upload to the appropriate directory, this method is simple and practical
7 Window System with SSH login Management Server, and SCP upload download file
Premise, install Cygwin under Windows, the following operation is the same as 5
1 ssh www.2cto.com
Execute in Cygwin: $ ssh [email protected]
2 SCP
The command SCP is based on the SSH protocol, which copies the local files to the specified directory on the remote service in the following format:
$ SCP filename [email protected]:remotedirectory
Execution: $ SCP ipmsg.log [email protected]:/home/admin
8 FTP Software mode
Step1. Configuring the FTP service on the cloud server
1. Under root, install vsftp with the following command.
[Email protected]_250_202_tlinux ~]# Yum Install vsftpd
2. Before starting the VSFTPD service, you need to log in to the cloud server to modify the configuration file and disable anonymous logins. Open the configuration file with the following command:
[Email protected]_250_202_tlinux ~]# vim/etc/vsftpd/vsftpd.conf
On line 11th of the configuration file, precede "Anonymous_enable=yes" with the # sign, and the anonymous login will be disabled.
3. Read the active configuration.
[Email protected]_250_202_tlinux ~]# cat/etc/vsftpd/vsftpd.conf |grep ^[^#]
local_enable=yeswrite_enable=yeslocal_umask=022anon_upload_enable=yesanon_mkdir_write_enable=yesanon_umask= 022dirmessage_enable=yesxferlog_enable=yesconnect_from_port_20=yesxferlog_std_format=yeslisten=yespam_service_ Name=vsftpduserlist_enable=yestcp_wrappers=yes
4. Start the VSFTPD service.
[[Email protected]_250_202_tlinux ~]# service vsftpd start
5. Set the FTP user account. Once the setup is successful, you can log in to the FTP server via this account. (1) Set the FTP user's account, for example, the account is "Ftpuser1", the directory is/home/ftpuser1, and the settings are not allowed to login via SSH.
[Email protected]_250_202_tlinux ~]# useradd-m-d/home/ftpuser1-s/sbin/nologin ftpuser1
(2) Set the password for the account, for example, the password is "Ftpuser1".
[Email protected]_250_202_tlinux ~]# passwd ftpuser1
6. Modify the PAM configuration of the VSFTPD so that the developer can connect to the cloud server via the FTP user account and password that they set up. (1) Modify Pam.
[Email protected]_250_202_tlinux ~]# vim/etc/pam.d/vsftpd
Content modified to:
#%pam-1.0 auth required/lib64/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed Auth Required/lib64/security/pam_unix.so Shadow Nullok Auth required/lib64/security/pam_shells.so account required/lib64/ security/pam_unix.so Session Required/lib64/security/pam_unix.so
(2) Confirm that the modified file is correct.
[Email protected]_250_202_tlinux ~]# cat/etc/pam.d/vsftpd#%pam-1.0 Auth required/lib64/security/pam_listfile.so Item=user sense=deny file=/etc/ftpusers onerr=succeed auth required/lib64/security/pam_unix.so Shadow Nullok Auth Required/lib64/security/pam_shells.so Account required/lib64/security/pam_unix.so Session required/lib64/security/ Pam_unix.so
(3) Restart the VSFTPD service for changes to take effect.
[Email protected]_250_202_tlinux ~]# service vsftpd restartshutting down vsftpd: [OK]starting vsftpd for vsftpd: [OK]
Step2. Uploading files to a Linux cloud server
1. Download and install the open source software FileZilla Please use FileZilla's 3.5.1, 3.5.2 version (FTP upload with 3.5.3 version of FileZilla will be problematic). Since the FileZilla website only offers the latest 3.5.3 download, it is recommended that developers search for 3.5.1, 3.5.2
Download address. Suggested 3.5.1:http://www.oldapps.com/filezilla.php?old_filezilla=6350.
2. Connect FTP to run FileZilla, configure it as shown, then click "Quick Link" after configuration:
The configuration information is described as follows: (1) Host: Cloud Server's public IP (on the cloud server "Administrative View" page to view the cloud server's public network IP). (2) Username: The FTP user's account set in Step1, this is the example of "Ftpuser1". (3) Password: Used for FTP set in STEP1
The password for the user account, which is "ftpuser1" for example. (4) Port: FTP Listening port, default is "21".
3. Upload files to the Linux cloud server when uploading files, the mouse selected local files, dragged to the remote site, the file uploaded to the Linux cloud server. Note: The Cloud server FTP channel does not support automatic decompression after uploading the tar package, and removing the tar pack feature.
9 SECURECRT
Download SecureCRT locally, unpack and open, click Quick Connect upload11
Enter the server IP address and user name and click Connect upload12
Enter the server password and click OK upload13
After successful connection, if the server does not have RZ software installed, enter Apt-get install LRZSZ, or yum install Lrzsz Enter to wait for installation Upload23
After installing RZ successfully, enter RZ, return UPLOAD14
Pop-up File Selection window, select the file you want to upload, click Add upload15
Wait for file upload, complete file upload after completion upload17
Input RZ
The uploaded file is under root by default
Upload to Linux server download file method collection