How to check whether vsftpd is installed in Linux

青灯夜游
Release: 2022-04-15 16:30:32
Original
7420 people have browsed it

Linux method to check whether vsftpd is installed: 1. Execute the "rpm -qa | grep vsftpd" command. If the relevant information about vsftpd is output, it means it has been installed, otherwise it is not installed; 2. Execute "vsftpd -v" command, if the version information of vsftpd is output, it means installation.

How to check whether vsftpd is installed in Linux

#The operating environment of this tutorial: CentOS 6 system, Dell G3 computer.

Check whether vsftpd is installed

Method 1: Use the rpm -qa | grep vsftpd command to Detection

If there is output related information about vsftpd, it means vsftpd has been installed, otherwise it means it has not been installed

How to check whether vsftpd is installed in Linux

Method 2: Use the vsftpd -v command to detect the installation version by viewing it

If the version information of vsftpd is output, it means it is installed, otherwise it means it is not installed

How to check whether vsftpd is installed in Linux

If vsftpd is not installed, you can use yum to install it

Since the vsftpd software depends on some other software and software libraries, it is installed using yum. Relatively easy

1. Configure the yum source

Network: When connected to the Internet, no other configuration is required

Cannot be connected to the Internet: You can configure the local yum source, The Centos system disk can be configured as u pan yum source

2. Install vsftpd

For installing software using yum method, you usually need to use Only root users can install. Installation command: yum -y install vsftpd

[root@localhost ~]# yum -y install vsftpd
Loaded plugins: fastestmirror, security
Setting up Install Process
Determining fastest mirrors
* base: centos.ustc.edu.cn
* extras: centos.ustc.edu.cn
* updates: mirror.bit.edu.cn
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:01
extras | 3.4 kB 00:00
extras/primary_db | 29 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 1.4 MB 00:00
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-24.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================
Installing:
vsftpd x86_64 2.2.2-24.el6 base 156 k

Transaction Summary
=============================================================================================================================
Install 1 Package(s)

Total download size: 156 k
Installed size: 340 k
Downloading Packages:
vsftpd-2.2.2-24.el6.x86_64.rpm | 156 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : vsftpd-2.2.2-24.el6.x86_64 1/1
Verifying : vsftpd-2.2.2-24.el6.x86_64 1/1

Installed:
vsftpd.x86_64 0:2.2.2-24.el6

Complete!
Copy after login

The installation is successful. You can use the sftpd -v command to check the version

3. Default configuration

3.1 Configuration file location

The vsftpd service configuration file is in the /etc/vsftp directory by default, and the core configuration file is vsftpd.conf.

[root@localhost ~]# ll /etc/vsftpd/
total 28
-rw-------. 1 root root 125 May 11 2016 ftpusers
-rw-------. 1 root root 361 May 11 2016 user_list
-rw-------. 1 root root 4599 May 11 2016 vsftpd.conf
-rwxr--r--. 1 root root 338 May 11 2016 vsftpd_conf_migrate.sh
-rw-------. 1 root root 4647 Jun 20 20:07 vsftpd.conf.rpmsave
[root@localhost ~]#
Copy after login

3.2 Default root directory

The default root directory of vsftp service is /var/ftp. The owner and group of this directory are both root.

[root@localhost ~]# ll -d /var/ftp/
drwxr-xr-x. 3 root root 4096 Jul 1 16:58 /var/ftp/
[root@localhost ~]# ll /var/ftp/
total 4
drwxr-xr-x. 2 root root 4096 May 11 2016 pub
[root@localhost ~]#
Copy after login

3.3 Default anonymous user

During the installation process of vsftpd, an ftp user will be created as a proxy user for anonymous users. The ftp user cannot log in to the system.

[root@localhost ~]# id ftp
uid=14(ftp) gid=50(ftp) groups=50(ftp)
[root@localhost ~]# cat /etc/passwd | grep ftp
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
[root@localhost ~]#
Copy after login

3.4 Default permissions

Under the default configuration, the vsftpd service is allowed Anonymous user access, using the Linux system user as the user source, allowing system users to log in.

  • Anonymous user permissions: root directory /var/ftp, readable, downloadable, unable to upload files, No new folders can be created, no files can be deleted/renamed

  • System user permissions: The root directory is the user's home directory, you can jump out of the user's home directory, and the permissions on files are controlled by linux user permissions.

System configuration

After installing vsftpd, you need to make some modifications to the system

  • ftp_home_dir: Solve non-root user login error: OOPS: child died

  • ##allow_ftpd_full_access: Solve the problem of unable to upload files

  • selinux: To solve the problem of not being able to log in to OOPS: priv_sock_get_cmd

  • [root@localhost vsftpd] setsebool -P ftp_home_dir on
    [root@localhost vsftpd] setsebool allow_ftpd_full_access on
    [root@localhost vsftpd]# vim /etc/selinux/config
    
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    # enforcing - SELinux security policy is enforced.
    # permissive - SELinux prints warnings instead of enforcing.
    # disabled - No SELinux policy is loaded.
    SELINUX=permissive
    # SELINUXTYPE= can take one of these two values:
    # targeted - Targeted processes are protected,
    # mls - Multi Level Security protection.
    SELINUXTYPE=targeted
    Copy after login

Server startup

Centos series can start the server through the service command. Stop, restart

1. Start the server

[root@localhost ~]# service vsftpd start
Starting vsftpd for vsftpd: [ OK ]
[root@localhost ~]#
Copy after login

2. Restart the server

[root@localhost ~]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
[root@localhost ~]#
Copy after login

3. Stop the server

[root@localhost ~]# service vsftpd stop
Shutting down vsftpd: [ OK ]
[root@localhost ~]#
Copy after login

4. Set auto-start at boot

You can choose to set the vsftpd service to auto-start at boot. You can use the chkconfig command or customize it. Startup script. I use the chkconfig command. chkconfig can set the boot startup for each run level of Linux.

    0: means shutdown
  • 1: single-user mode
  • 2: Multi-user command line mode without network connection
  • 3: Multi-user command line mode with network connection
  • 4: Not available
  • 5: With graphical interface Multi-user mode
  • 6: Restart
4.1 View vsftpd service startup status

[root@localhost ~]# chkconfig | grep vsftpd
vsftpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@localhost ~]#
Copy after login

4.2 Modify vsftpd startup

    We only set the boot level to 35 to automatically start the vsftpd service.
  • [root@localhost ~]# chkconfig --level 35 vsftpd on
    [root@localhost ~]# chkconfig | grep vsftpd
    vsftpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
    [root@localhost ~]#
    Copy after login

vsftpd firewall settings

    vsftpd service listens to ports 20 and 21 by default. If other computers want to access, they need to release the firewall port or close the firewall. Turning off the firewall is not recommended.
  • vsftpd uses the PASV security mode by default to transmit data, so it needs to be set PASV port upper and lower limits, and release the port

1. Set the PASV port upper and lower limits

Edit the configuration file: /etc/vsftpd/vsftpd.conf, Append two lines at the end of the file:

#设定PASV 端口下限
pasv_min_port=61000
#设定PASV 端口上限
pasv_max_port=62000
Copy after login

2. Release the firewall port

Edit the configuration file: /etc/sysconfig/iptables, add the following configuration to the file:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 20 -j ACCEPT
-A OUTPUT -m state --state NEW -m tcp -p tcp --dport 20 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A OUTPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 61000:62000 -j ACCEPT
-A OUTPUT -m state --state NEW -m tcp -p tcp --dport 61000:62000 -j ACCEPT
Copy after login

3. Restart the service

Restart the vsftpd service and firewall

[root@localhost ~]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
[root@localhost ~]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: [ OK ]
[root@localhost ~]#
Copy after login

相关推荐:《Linux视频教程

The above is the detailed content of How to check whether vsftpd is installed in Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template