ProFTPD complex permission settings

Source: Internet
Author: User

I. Test Platform

Debian 4.0r3
ProFTPD 1.3.1 (with SSL)

Ii. Principles

1. Inheritance
The subdirectory inherits the attributes of its parent directory.

2. Priority
The priority ranges from large to small:
Original FTP command (list DELE, etc.)> Command Group (dirs read write)> All Command Group

3. Application sequence of access control
Regardless of the order, the application is deny first, and then the application is allowed (allow)

4. System Permissions
Linux permissions still work. If the <limit> write permission is set for the test directory, the user only
Read Permission. This means that the user cannot write data to the test directory.

<Directory/ftproot/test> ----------------- 1. Inheritance
<Limit dirs> ------------------------- 2. Priority
Allowuser U1 ------------------ 3. Application sequence of access control
Denyall
</Limit>
</Directory>

One explanation: According to reference 1, the sequence of access control should be related to the sequence of access control, but in my test, the sequence of access control has no effect. That is to say, like the above access control, allowuser U1 and denyall are both in front of each other.

 

Iii. Instances

1. Introduction

Assume that the ProFTPd server has five users:
Manager, mana1, mana2, manb1, manb2
And two groups:
GroupA, groupB

Mana1 and mana2 belong to the groupA group, and manb1 and manb2 belong to the groupB group.

The directory structure is as follows:

/Root directory
│
├ Ftproot/
│ Volume Manager/
│
│ ├ GroupA/
│ G0a1/
│ G0a2/
│ Large .../
│
│ ├ GroupB/
│ 10000b1/
│ ├ B2/
│ Large .../
│
.../

Permissions to be implemented:
1. User Manager can read and write the manager, groupA, and groupB directories and Their subdirectories.
2. mana1 can read and write the A1 directory and all subdirectories of groupB.
3. mana2 can read and write the A2 directory and all subdirectories of groupB.
4. manb1 can read and write the B1 directory.
5. manb2 can read and write the B2 directory.
6. If a user does not have access to a directory, the user cannot see the directory.
7. Only manger users and group GroupA and group B members are allowed to access the FTP server.
8. No one is allowed to break the main directory structure

2. Implementation

(1) Add users and groups

Useradd Manager
Passwd Manager

Groupadd groupA
Groupadd groupB

Useradd mana1
Passwd mana1
Usermod-G groupA mana1

Useradd mana2
Passwd mana2
Usermod-G groupA mana2

Useradd manb1
Passwd manb1
Usermod-G groupB manb1

Useradd manb2
Passwd manb2
Usermod-G groupB manb2

(2) configuration file

# This is a basic ProFTPD configuration file (rename it
# 'Proftpd. conf' for actual use. It establishes a single server
# And a single anonymous login. It assumes that you have a user/group
# "Nobody" and "ftp" for normal operation and anon.
Servername "formax bpo ftp server"
Servertype Standalone
Defaultserver on
# Port 21 is the standard FTP port.
Port 21
Usereversedns off
Identlookups off # umask 022 is a good standard umask to prevent new dirs and files
# From being group and world writable.
Umask 000
# To prevent DoS attacks, set the maximum number of child Processes
# To 30. If you need to allow more than 30 concurrent connections
# At once, simply increase this value. Note that this only works
# In standalone mode, in inetd mode you shoshould use an inetd Server
# That allows you to limit maximum number of processes per service
# (Such as xinetd ).
Maxinstances 30
# Set the user and group under which the server will run.
User nobody
Group nogroup
# To cause every FTP user to be "Jailed" (chrooted) into their home
# Directory, uncomment this line.
# Defaultroot ~
Defaultroot/ftproot
# Normally, we want files to be overwriteable.
Allowoverwrite on
Allowstorerestart on
Serverident off

<Ifmodule mod_tls.c>
Tlsengine on
Tlslog/var/ftpd/TLS. Log
Tlsprotocol sslv23

# Are clients required to use ftp over TLS when talking to this server?
Tlsrequired on

# Server's certificate
Tlsrsacertificatefile/etc/ProFTPd. Cert
Tlsrsacertificatekeyfile/etc/ProFTPd. Key

# Ca the server trusts
Tlscacertificatefile/etc/ProFTPd. Cert

# Authenticate clients that want to use ftp over TLS?
Tlsverifyclient off
Tlsoptions nocertrequest
# Allow SSL/TLS renegotiations when the client requests them,
# Do not force the renegotations. Some clients do not support
# SSL/TLS renegotiations; When mod_tls forces a renegotiation, these
# Clients will close the data connection, or there will be a timeout
# On an idle data connection.
Tlsrenegotiate required off
</Ifmodule>

# Bar use of site chmod by default
<Limit site_chmod>
Denyall
</Limit>

<Limit login>
Allowuser Manager
Allowgroup groupA
Denyall
Allowgroup groupB
</Limit>

<Directory/ftproot/*>
<Limit all>
Denyall
</Limit>
</Directory>
<Directory/ftproot/Manager>
<Limit all>
Allowuser Manager
</Limit>
</Directory>
<Directory/ftproot/groupA>
<Limit dirs>
Allowuser Manager
Allowgroup groupA
</Limit>
</Directory>
<Directory/ftproot/groupA/*>
<Limit dirs>
Denyall
</Limit>
</Directory>
<Directory/ftproot/groupA/A2>
<Limit dirs read write>
Allowuser Manager
Allowuser mana2
Denyall
</Limit>
</Directory>
<Directory/ftproot/groupA/A1>
<Limit dirs read write>
Allowuser Manager
Allowuser mana1
Denyall
</Limit>
</Directory>
<Directory/ftproot/groupB>
<Limit dirs>
Allowuser Manager
Allowgroup groupA
Allowgroup groupB
</Limit>
</Directory>
<Directory/ftproot/groupB/*>
<Limit dirs>
Denyall
</Limit>
</Directory>
<Directory/ftproot/groupB/B1>
<Limit dirs read write>
Allowuser Manager
Allowuser manb1
Allowgroup groupA
Denyall
</Limit>
</Directory>
<Directory/ftproot/groupB/B2>
<Limit dirs read write>
Allowuser Manager
Allowuser manb2
Allowgroup groupA
</Limit>
</Directory>

Refer:
1. http://www.castaglia.org/proftpd/doc/contrib/ProFTPD-mini-HOWTO-Limit.html
2. http://www.castaglia.org/proftpd/
3. http://www.proftpd.org/

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.