After installing Linux, open ftp first. RedHatEnterpriseLinux4.7 has a GSftp by default. However, there are too few discussions on the Internet, and there is basically no information. Use vsftp. It is installed by default, and can be started in the Service (I opened it in gnome ). Check whether the package is installed: rpm-qvsftpd displays the version number. Vsftp has three modes: anonymous login, local user login, and virtual user login. Anonymous user
After installing Linux, open ftp first. Red Hat Enterprise Linux 4.7 has a GSftp by default, but it is rarely discussed on www.southe.com. there is basically no information. Use vsftp. It is installed by default, and can be started in the Service (I opened it in gnome ). Check whether the package is installed: The rpm-q vsftpd version is displayed.
Vsftp has three modes: anonymous login, local user login, and virtual user login. Anonymous Users are the best and safe virtual users. However, it is too troublesome to read the information. I also need to use other tools or databases to store user information. Anyway, I don't do Professional ftp, but I just want to upload something myself. I 'd better use a local user.
1. First, create the ftp directory and user
Simple Directory Creation: mkdir/tmp/ftp
It is very easy to create a group and use a GUI, just like windows. But since LiInux is used, it is better to learn some commands.
Group Creation: groupadd ftpuser (I didn't add this step. Instead, I created a user to use it myself and didn't want to create any group. When the following useradd is used, if no group is specified, the system automatically creates a group with the same name .)
Create user
Useradd-G test-d/tmp/test-M-s/sbin/nologin ftpuser
Note: The user I created is ftpuser. Other parameters: G: the user's group (this is not specified); d: specify the location of the user's own directory to create; M: do not create a default home directory, that is to say, there is no directory in/home; s: the shell that the user logs on to. Here/sbin/nologin does not have a shell, because the ftp user does not need to log on to the system.
Set the user's password:
Passwd ftpuser and then enter the password twice. In addition, the command for deleting a user is userdel-r ftpuser.
Now, if the vsftpd service is on, you can access it, but you can only view it and cannot upload it. Because you do not have the permission in the directory.
Ii. directory permission settings
Two Methods: Set the directory owner to ftp user: chown ftpuser/tmp/ftp
You can also set the directory permission to 777 (for your own use, some files are temporarily transferred under ftp, and you have all the permissions)
Chmod 777/tmp/ftp ---- 7 indicates wrx 5 indicates rx 0 indicates no Permissions
This seems to be enough. After ftp login, you can go around and view all the directories in the system. If this is not the case, you should restrict the user to the ftp directory.
3. Restrict Directories
In this case, modify/etc/vsftpd. conf. There is a lot of content in it, so you don't have to study it carefully.
The document states that you must confirm the three options: local_enable = yes, write_enable = yes, And chroot_local_usr = yes. I think the first two items are already yes by default, that is, the chroot_local_usr at the end needs to be changed to YES. After the modification, the system prompts "cocould not open chroot () list file:/etc/vsftpd. chroot_list" during login. The system did not have the vsftpd. chroot_list file.
Touch/etc/vsftpd. chroot_list, create this file, and write the userftp name in it. OK. After restarting, you can no longer run around.
Restart command of vsftpd: service vsftpd restart (start stop)
I forgot one. I should change anonymous_enable = YES to NO and disable anonymous login.