![]() auth required pam_pwdfile.so pwdfile /etc/vsftpd/ftpd.passwd I insist only these 2 lines, I wasted a lot of time keeping the originals and just added these. Sudo mv /etc/pam.d/vsftpd /etc/pam.d/vsftpd.bakĬopy and paste these 2 lines (this should be the only content). Sudo htpasswd -d /etc/vsftpd/ftpd.passwd user2Īgain, you need to back up the orignal file ![]() d forces MD5, you need it on ubuntu 12.04, just use it always c means that we’ll create the file if it’s not existing yet Sudo htpasswd -cd /etc/vsftpd/ftpd.passwd user1 Create a vsftpd folder then put configuration files in it. To register a user you use htpasswd, so I assume you have apache2 working on your The file should ONLY contain these lines: listen=YES Sudo mv /etc/nf /etc/Ĭopy and paste the following lines. Sudo apt-get install vsftpd libpam-pwdfileįirst you need to back up the original file A PAM (Pluggable Authentication Modules) will help you create virtual users. I wanted to create FTP users but I didn’t want to add local unix users (no shell access, no home directory and so on). Install vsftpd (Very Secure FTP Deamon) and libpam-pwdfile to create virtual users.Set directories with the correct chmod and chownĬreate a admin user with full access to the server Maybe will work for You.Įdit /etc/nf and /etc/pam.d/vsftpdĬreate user accouts with custom directories (in /var/www/ for example) If the subfolder is intended to be modifiable by the user, it might be necesary to change the owner of the shared subfolder: chown vsftpd:nogroup /var/www/website_name1/sub_folder1 Important to remember if you do not create a user conf file it will default to the var/www folder as root (in the example above) That's it you can now add as many users as you want and limit their access to whatever folder you wish. Var/www/website_name1/sub_folder1 and any folder and file inside it. You should now be able to login as user1 who will only be able to see Now create the user file: nano /etc/vsftpd_user_conf/user1Īnd enter the following line local_root=/var/www/website_name1/sub_folder1 Going back to the question we want user1 to only have access to var/www/website_name1/sub_folder1, so we need to create the vsftpd_user_conf folder: mkdir /etc/vsftpd_user_conf This file the same as the nf so you can define a new local_root This means that when user1 logs in it will look for the following file /etc/vsftpd_user_conf/user1 The important line here is the following user_config_dir=/etc/vsftpd_user_conf The user must match guest_username=vsftpd in the vsftpd conf file These users will not have access to the shell and will be called vsftpd useradd -home /home/vsftpd -gid nogroup -m -shell /bin/false vsftpd Next we need to add a user for these virtual users to use. This will enable login for your virtual users defined in /etc/vsftpd/ftpd.passwd and will disable local users Once your users are created you can now change your PAM config file nano /etc/pam.d/vsftpdĪnd remove everything inside this file and replace with the following auth required pam_pwdfile.so pwdfile /etc/vsftpd/ftpd.passwd I've only managed to get it to work using CRYPT which limits to 8 chars to use more than 8 chars use openssl to generate a compatible hash and pipe directly into htpasswd htpasswd -c -p -b /etc/vsftpd/ftpd.passwd user1 $(openssl passwd -1 -noverify password) Htpasswd -cd /etc/vsftpd/ftpd.passwd user1Īdding additional users just omit the -c htpasswd -d /etc/vsftpd/ftpd.passwd user2 Make a directory to store your users mkdir /etc/vsftpd You can either use a database or htpasswd I found htpasswd faster and easier to use. Using 2707974 answer and information I've gained else where I've been able to get what I need.įirst you need vsftp and PAM installed apt-get install vsftpd libpam-pwdfileĮdit /etc/nf nano /etc/nfĮdit to your exact needs the most important bit for virtual users is everything after the virtual user settings comment With a bit of playing around I've managed to come up with a semi solution (not perfect but good enough) How to setup VSFTPD for multiple users including adding specific directoriesīut it recommends proftpd which I though was general less secure. I have found ways to to add users to see the whole strucutre or setup user named folders both of which have no use to me. My point being I need to be able to choose which folder and sub folders on a user by user basis. The main account has access to the www folder and all sub directories and I want to add a virtual user that can have access to the sub_folder1 and only sub_folder1Īlso to avoid some confusion I would also require another user to access sub_folder3 and only sub_folder3. The reason why I want to use virtual users is I only want to have 1 real user on the server. I need to be able to add a virtual users to vsftpd that only have access to a sub folder. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |