Install and Configure FTP for loading and unloading in Ubuntu, and configure Local User Logon (which is feasible in test). install and configure ubuntu
Reprinted: http://zyjustin9.iteye.com/blog/2178943
1. Installation
1. Install vsftpd with apt-get:
Java code
- $ Sudo apt-get install vsftpd
2. Check whether the FTP port is enabled.
Java code
- $ Netstat-tnl
Alternatively, enter "ftp: // server IP Address" in the browser"
Command for enabling, stopping, and restarting the vsftpd service:
Xml Code
- Service vsftpd start | stop | restart
Ii. Configuration
1. modify the configuration file
Java code
- $ Sudo vi/etc/vsftpd. conf
Main Configuration:
Xml Code
- Listen = YES # server listener
- Local_enable = YES # whether to allow access by local users
- Write_enable = YES # whether to allow file upload. If this parameter is not enabled, the system reports 550 permission denied.
- Anonymous_enable = NO # anonymous access is allowed. It is disabled by default,
- # Anon_upload_enable = YES # anonymous upload is allowed. The default value is NO.
- # Anon_mkdir_write_enable = YES # Allow Anonymous Folder creation
User access directory permission settings:
By default, after logging on to FTP, a local user can use the cd command to switch to another directory, which brings security risks to the system. You can use the following three configuration files to control user directory switching.
Xml Code
- Chroot_local_user = YES # specifies whether the user in the user list file can switch to the parent directory. The default value is NO.
- Chroot_list_enable = YES # Sets whether to enable the user list file specified by the chroot_list_file configuration item. The default value is NO.
- Chroot_list_file =/etc/vsftpd. chroot_list
- # The Disabled list, in the format of one user per row, is used to specify the user list file, which is used to control which users can switch to the parent directory of the user's home directory.
The following effects can be achieved through combination:
Xml Code
- (1 ). when chroot_list_enable = YES, chroot_local_user = YES, in/etc/vsftpd. users listed in the chroot_list file can switch to other directories. Users not listed in the file cannot switch to other directories.
- (2 ). when chroot_list_enable = YES, chroot_local_user = NO, in/etc/vsftpd. users listed in the chroot_list file cannot switch to other directories. Users not listed in the file can switch to other directories.
- (3). When chroot_list_enable = NO, chroot_local_user = YES, all users cannot switch to other directories.
- (4). When chroot_list_enable = NO and chroot_local_user = NO, all users can switch to other directories.
Other configurations:
Xml Code
- Local_umask = 022 # local file permission on FTP. The default value is 077.
- Dirmessage_enable = YES # enter the folder to allow
- Xferlog_enable = YES # ftp logging allowed
- Connect_from_port_20 = YES # enable port 20 as the data transmission Port
- Xferlog_enable = yes # activate upload and download logs
- Xferlog_std_format = yes # use the standard log format
- Ftpd_banner = XXXXX # Welcome Information
Related links:
Vsftpd configuration file details
2. Restart the vsftpd service.
Java code
- $ Sudo/etc/init. d/vsftpd restart
- Or
- $ Sudo service vsftpd restart
Note: After modifying the configuration file, you must restart the service to take effect.
3. add and delete users through FTP
1. Add users
# Creating a directory
Java code
- Mkdir-p/home/
# Create a user
Java code
- Sudo useradd-g ftp-d/home/test456-m test456
(Note: g: the user's Group d: Specifies the location where the user's own directory is created. m: No default home directory is created, that is, no home directory exists under/home)
# Set a User Password
Java code
- Sudo passwd test456
Edit the/etc/vsftpd. chroot_list file, add the account name of ftp (test456), save and exit.
Restart vsftpd:
Java code
- $ Sudo service vsftpd restart
Note: After modifying the user permission file vsftpf. chroot_list, you must restart the service to make the modification take effect.
2. Enter the Firefox browser and enter ftp: // 192.168.132.132 (the IP address here is the IP address of your host. If you do not know it, you can use ifconfig to view it)
Shows the final effect:
3. delete a user
Java code
- $ Sudo userdel test456
4. Uninstall
Sudo apt-get remove -- purge vsftpd
(-- Purge option indicates that the software modification and related files are permanently deleted)