This post explains how to modify the proFTPd Administrator tool to make the create users tool actually create individual directories for each account that is created.
Requirements
This feature is designed to work from within the admin web interface so the following has to be installed:
- CentOS 5.x with LAMP installed.
- proFTPd installed and configured for virtual users.
- proFTPd Administrator installed.
Configuration
In the config file you can set a script to run every time a user is created (a sample script is included in themisc/user_create
subfolder).Note |
---|
When we refer to this script in the configuration files, we have to include the absolute path. This document assumes that the proFTPd Administrator tool has been installed in /usr/share/proftpd_admin/ . |
Running the script to alter permissions and creating home directories requires root-access from the script. We will use the sudo tool to accomplish this.
- Check if sudo is installed:
yum install sudo
- The file /etc/sudoers, has the rules that users have to follow when using sudo command. Edit the
sudoers
file:
nano /etc/sudoers
and add the following few lines:
# Cmnd alias specification Cmnd_Alias CREATE_USER = /usr/share/proftpd_admin/misc/user_script/create_user.sh # User privilege specification nobody ALL=(ALL) NOPASSWD: CREATE_USER
- Ensure proFTPd-admin includes the
create_user
script. Editinclude_config.php
:
nano /usr/share/proftpd_admin/include_config.php
add the following line to the end of the$ config ...
statements at the top of the file:
$config_createuser_command = "sudo /usr/share/proftpd_admin/misc/user_script/create_user.sh";
- Edit the
create_user.sh
to create home directory and setup correct user and group ownerships. (They are included in thecreate_user_example.sh
script):
cd /usr/share/proftpd_admin/misc/user_script/ mv create_user.sh create_user_old.sh cp create_user_example.sh create_user.sh
- Now check the
create_user.sh
file:
nano create_user.sh
and ensure the file contains the following:
#!/bin/bash USER=$1 USER_ID=$2 GROUP_ID=$3 mkdir -p /ftp/$USER chown $USER_ID.$GROUP_ID /ftp/$USER
- Ensure the security hasn't been compromised by running the following commands:
chown -R root.root /usr/share/proftpd_admin/misc/user_script chmod 700 -R /usr/share/proftpd_admin/misc/user_script
References
Subscribe to: Post Comments (Atom) - The file /etc/sudoers, has the rules that users have to follow when using sudo command. Edit the
No comments:
Post a Comment