Menü +

find ./ -type f -name '*source-string*'

vsftpd

# ----------------------------------------------------------------------
# --- Fixing Write Permissions for Chrooted FTP Users in vsftpd
# --- https://sys4.de/en/blog/2013/03/25/vsftpd-local-chrooted-user-write-access-ubuntu-precise-1204/
#
#
apt-get install vsftpd
#
chroot_local_user=YES
write_enable=YES
allow_writeable_chroot=YES
#
listen=YES
anonymous_enable=NO
local_enable=YES
virtual_use_local_privs=YES
write_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd
pam_service_name=vsftpd
guest_enable=YES
ftp_username=www-data
chmod_enable=YES
chown_uploads=YES
chown_username=www-data
guest_username=www-data
force_dot_files=YES
pasv_enable=YES
pasv_promiscuous=YES
pasv_min_port=1024
pasv_max_port=65535
max_clients=10
max_per_ip=10
port_promiscuous=YES
port_enable=YES
listen_port=21
ftp_data_port=20
user_sub_token=$USER
hide_ids=YES
user_config_dir=/etc/vsftpd
chroot_local_user=YES
allow_writeable_chroot=YES
#
mkdir /etc/vsftpd
cd /etc/vsftpd
#
vim $USER
local_root=/var/www/www.exmaple.com/htdocs
#
# ----------------------------------------------------------------------
# --- Fixing FIX
# --- http://askubuntu.com/questions/413677/vsftpd-530-login-incorrect
#
cp /etc/vsftpd.conf /etc/vsftpd.conf.back
vim /etc/vsftpd.conf
pam_service_name=ftp
sudo service vsftpd restart
# ----------------------------------------------------------------------
# --- http://www.sigerr.org/linux/setup-vsftpd-custom-multiple-directories-users-accounts-ubuntu-step-by-step/
# --- Setup VSFTPD with custom multiple directories and (virtual) users accounts on Ubuntu (no database required)
#
apt-get install vsftpd libpam-pwdfile
mv /etc/vsftpd.conf /etc/vsftpd.conf.bak
vim /etc/vsftpd.conf
#
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
nopriv_user=vsftpd
virtual_use_local_privs=YES
guest_enable=YES
user_sub_token=$USER
local_root=/var/www/$USER
chroot_local_user=YES
hide_ids=YES
guest_username=vsftpd
#
mkdir /etc/vsftpd
#  Create a vsftpd folder then put configuration files in it.
htpasswd -cd /etc/vsftpd/ftpd.passwd user1
# If you want to add new users afterwards:
htpasswd -d /etc/vsftpd/ftpd.passwd user2
#
# 4. Configure PAM in /etc/pam.d/vsftpd
#
mv /etc/pam.d/vsftpd /etc/pam.d/vsftpd.bak
vim /etc/pam.d/vsftpd
auth required pam_pwdfile.so pwdfile /etc/vsftpd/ftpd.passwd
account required pam_permit.so
#
useradd --home /home/vsftpd --gid nogroup -m --shell /bin/false vsftpd
#
service vsftpd restart
###
###
###
mkdir /var/www/user1
chmod -w /var/www/user1
mkdir www/user1/www
chmod -R 755 /var/www/user1/www
chown -R vsftpd:nogroup /var/www/user1
###
###
###
# Create an Admin user to access the entire server
htpasswd -d /etc/vsftpd/ftpd.passwd theadmin
chroot_list_enable=YES
#
# To create an admin user we need to register a new user with htpasswd.
# Before we do so, I’ll advise you to check into the /etc/ftpusers file that define certain users that are not allowed 
# to connect with ftp. I think it’s only for local users and not virtual users but just in case don’t choose a name 
# contained in this file. Let’s be honest, vsftpd is complicated enough!
htpasswd -d /etc/vsftpd/ftpd.passwd theadmin
# Now we need to add a new line into /etc/vsftpd.conf
chroot_list_enable=YES
# This means that your user will be placed into their folder (as a jail) EXCEPT users in the /etc/vsftpd.chroot_list
# Let’s create this file and add our user, the file is a simple line containing “theadmin”. Add one user per line. 
# That means you DON’T need to create a /var/www/theadmin folder, the user will login and start in /home/vsftpd.
# Restart the server and you’re done !

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.