Tag Archives: sftp

ftp/sftp – vsftpd

 

One liners to automatic creation of username and passwords

Automatic creation of users/passwords (FTP)

Manually create list.txt with user:doc_root
e.g.:

Get commands to create FTP users

 

Get commands to set FTP permissions (if doc_root exists already)

 

Generate and Assign random passwords to the users.

 


Create a list of vhosts’ paths: vhosts.txt

Example with only .com domains:
/var/www/domain1.com
/var/www/domain2.com
/var/www/domain3.com

Use a regex for sed to extract the vhost name, removing dots (example based on the example above)
This will return a list of PATH and VHOSTNAME. We will use VHOSTNAME as USER for that path

 

Print out the commands to run to add FTP users (no SSH)
Once checked the output, run these lines

(for sftp only):

 

This will print out commands to run to assign user:apache_group to the vhosts’ paths

(for sftp only):

 

Set g+s on vhosts to preserve directory owner
[TO CHECK]

[THIS EXECUTE]

 

Create list of random passwords using pwgen

 

Create list of random passwords using openssl

 

Apply these passwords automatically

 

Print output for reference