Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Build FTP by Centos6.5

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Check to see if vsftpd is installed

[root@htuidc] # rpm-Q vsftpd

Package vsftpd is not installed indicates that it is not installed

Vsftpd-2.2.2-24.el6.x86_64 is installed

two。 Install vsftp

[root@htuidc ~] # yum-y install vsftpd

3. Install ftp

[root@htuidc ~] # yum-y install ftp

4. Restart vsftpd restart twice in a row

[root@htuidc ~] # service vsftpd restart

Set vsftpd to boot

[root@htuidc ~] # chkconfig vsftpd on

5. Modify firewall-system must be rebooted

[root@htuidc ~] # vi / etc/selinux/config

SELINUX=disabled

6. Temporarily turn off the firewall-take effect immediately without reboot

[root@htuidc ~] # setenforce 0

7. Configure the firewall

[root@htuidc ~] # vi / etc/sysconfig/iptables

-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 21-j ACCEPT

-A RH-Firewall-1-INPUT-m state-- state NEW-m tcp-p tcp-- dport 21-j ACCEPT

8. Restart the firewall

[root@htuidc ~] # service iptables restart

9. Modify the main configuration file of vsftpd

[root@htuidc ~] # vi / etc/vsftpd/vsftpd.conf

Anonymous_enable=NO

Chroot_local_user=YES

10. The service must be restarted after modification

[root@htuidc ~] # service vsftpd restart

11. The user directory for creating ddd is / var/gpj

[root@htuidc htm] # useradd-s / sbin/nologin-d / var/gpj ddd

twelve。 Set the password for ddd

[root@htuidc ~] # passwd ddd

Changing password for user ddd.

New password:

BAD PASSWORD: it is based on your username

Retype new password:

Passwd: all authentication tokens updated successfully.

13. View Port

[root@htuidc ~] # netstat-tunlp | grep vsftpd

Tcp 0 0 0.0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0

14. To modify the root directory of ftp, you can simply modify the / etc/vsftpd/vsftpd.conf file:

Add the following lines:

Local_root=/var/www/html

Chroot_local_user=YES

Anon_root=/var/www/html

Modify the folder vi / etc/passwd where the user is logged in

Add the ftp user to Linux and set the appropriate permissions as follows:

1. Environment: ftp is vsftp. The restricted user name is test. The restricted path is / home/test

2. Build users: under root users:

Useradd-d / home/test test / / add user test and make the home directory of test user / home/test

Passwd test / / set the password for test

3. Change the corresponding permission settings of the user:

Usermod-s / sbin/nologin test / / user test cannot be telnet, only ftp

Usermod-s / sbin/bash test / / user test returns to normal

Usermod-d / test test / / change the home directory of user test to / test

4. Restrict users to access only / home/test and cannot access other paths

Modify / etc/vsftpd/vsftpd.conf as follows:

Change "anonymous_enable=YES" to "anonymous_enable=NO" in the configuration file

Unconfigure the comment symbols as follows:

Local_enable=YES

Write_enable=YES

Chroot_local_user=YES

Chroot_list_enable=YES / / restrict access to your own directory

# (default follows)

Chroot_list_file=/etc/vsftpd/vsftpd.chroot_list

Edit the vsftpd.chroot_list file to add restricted users, one line for each user name

After changing the configuration file, don't forget to restart the vsFTPd server

[root@linuxsir001 root] # / etc/init.d/vsftpd restart

Reference:

Http://help.aliyun.com/knowledge_detail.htm?knowledgeId=5974492&categoryId=8314853

Http://help.aliyun.com/knowledge_detail.htm?knowledgeId=5973912&categoryId=8314853

Build user, in command line status, under root user:

Run the command: "useradd-d / home/test test" / / add the user test and set the home directory of the test user as / home/test

Run the command: "passwd test" / / set the password for test, and enter the same password twice after running

Change the appropriate permission settings for the user:

Run the command: "usermod-s / sbin/nologin test" / / limit user test cannot telnet, only ftp

Run the command: "usermod-s / sbin/bash test" / / user test returns to normal

Run the command: "usermod-d / test test" / / change the home directory of user test to / test

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report