Iup FTP upload configuration.

Source: Internet
Author: User
Tags ftp connection

 

1. Installation

1 install dependency package: libssh2-1.2.7.tar.gz (other dependent package general system comes with, if not installed)

# Cd depended

# Tar-zxvf libssh2-1.2.7.tar.gz

# Cd libssh2-1.2.7

#./Configure

# Make

# Make install

2. Add "/usr/local/lib" to/etc/lD. So. conf"

# Echo "/usr/local/lib">/etc/lD. So. conf

3. Run ldconfig

4. Delete the libcurl of an earlier version.

# Find/-name libcurl. So .*

# Find/-name libcurl. *

Delete the file found after the preceding two commands are executed.

# Rm-f xxxx // XXXX indicates the curl dynamic library and static library found.

5 install the curl-7.21.4.tar.gz package

# Tar-zxvf curl-7.21.4.tar.gz

# Cdcurl-7.21.4

#./Configure

# Make

# Make install

# Ldconfig

6. Verify that libcurl is successfully installed.

# Curl -- version

If the information is as follows, the operation is successful:

Curl 7.21.4 (i686-pc-linux-gnu) libcurl/7.21.4 OpenSSL/0.9.8b zlib/1.2.5 libidn/1.0 libssh2/1.2.7

Protocols: dict file FTP ftps gopher http https imap IMAPs ldap ldaps POP3 pop3s rtsp scp sftp smtp smtps Telnet TFTP

Features: IDN IPv6 largefile ntlm ssl libz

 

Ii. configuration file of the upload Module

Go to the configuration file directory: Edit inotify_up.conf.

# CD ../src/up_src

# Vi inotify_up.conf

Explanation:

1. transfer_mode can be configured with three protocols: FTP, SFTP, and SCP.

2. Set server_ip to the IP address of the server to be uploaded.

3. Set server_port to the port number used by the Protocol.

4. enter username in user_name

5. passwd enter the password

6. server_dir indicates the directory to which the IP address is uploaded. Note: For FTP-based transmission, enter the home object of the user name.

The relative address of the log. For example, the root user's home directory is/root/. If you want to transfer the data to the Home Directory, configure it to "server_dir =. For SFTP or SCP, enter the absolute path.

7. Directory monitored locally by source_file_path. Multiple local directories can be configured, with one per line.

Last line break "\"

8. suffix indicates the suffix of the file to be monitored. For example, "CTR"

9. reflected_suffix indicates the suffix of the. CTR file to be mapped, such as XML

10. suffix_process indicates the relationship between the file with the listening suffix name and the actual file name to be processed. There are three mappings:

(1) If replace listens to AAA. xml. Ctr, the file to be transmitted is aaa.xml.txt.

(2) If cut listens to AAA. xml. Ctr, the file to be transmitted is AAA. xml.

(3) If no_reflect listens to AAA. xml. Ctr, the file to be transmitted is AAA. xml. Ctr.

11. is_compress: yes or no

12. append_okfile: yes or no

13. sleep_period is measured in seconds. Indicates the transmission period.

 

 

Iii. compilation and use of the upload Module

Go to the up_src directory:

# Make

#./Run

 

If you want to perform a scheduled task:

Add a scheduled run script to the/etc/cron. d/cron_dcol file, for example, the following statement:

*/1 ***** root/transfer/aut_dcol

 

Iv. vsftp configuration and adding users

1. edit/etc/vsftpd. conf and add the following content:

 

Pam_service_name = vsftpd

Userlist_enable = Yes

Tcp_wrappers = Yes

Anon_upload_enable = Yes

Anon_mkdir_write_enable = Yes

Anon_world_readable_only = No

Anon_other_write_enable = Yes

Chown_uploads = Yes

2. Restart vsftpd

# Service vsftpd restart

# Chkconfig vsftpd on

3. Added vsftpd users:

# Adduser ftpuser // Add User

# Mkdir-P/home/pcap_file // create a home directory

# Usermod-g ftp user1 // modify user usermod-D/home/pcap_file-g ftp ftpuser

# Vim/etc/passwd // modify the Home Directory of ftpuser to/home/pcap_file

# Pwconv // update/etc/passwd and/etc/shadow

# Chown-r ftpuser. FTP/home/pcap_file

# Passwd ftpuser // modify the password of the user name

4. The following problems may be caused by SELinux:

The 500 Oops: cannot change Directory:/root error occurs during FTP connection. SELinux does not enable ftp by default, so access is blocked.

Solution 1:
A. View SELinux settings
# Getsebool-A | grep FTP

The results are as follows:

Allow_ftpd_anon_write --> off

Allow_ftpd_full_access --> off

Allow_ftpd_use_cifs --> off

Allow_ftpd_use_nfs --> off

Ftp_home_dir --> on

Ftpd_connect_db --> off

Sftpd_anon_write --> off

Sftpd_enable_homedirs --> off

Sftpd_full_access --> off

Or

Ftp_home_dir-> off
B. Use the setsebool command to enable all the preceding switches. For example:
# Setsebool ftpd_disable_trans 1 or # setsebool ftp_home_dir 1
C. Check whether the current status is on.
# Getsebool-A | grep FTP
In this case

Allow_ftpd_anon_write --> on

Allow_ftpd_full_access --> on

Allow_ftpd_use_cifs --> on

Allow_ftpd_use_nfs --> on

Ftp_home_dir --> on

Ftpd_connect_db --> on

Sftpd_anon_write --> on

Sftpd_enable_homedirs --> on

Sftpd_full_access --> on

Sftpd_write_ssh_home --> on

D. Last restart # service vsftpd restart

OK. The problem is resolved.

In addition, setsebool uses the-p parameter. You do not need to enter this command every time you start the system.
# Setsebool-P ftpd_disable_trans 1
Or
# Setsebool-P ftp_home_dir 1

 

Solution 2:

Disable SELinux: Modify SELinux = "" in the/etc/SELinux/config file to disabled, and then restart.

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.