0

I am having troubles with vsftpd server and creating folders with the correct permissions on ubuntu 14.04

Would it be possible to have a clear step by step tutorial on how to create a user and configure the folder permissions and access accordingly?

In my example I would like to create user1. Create a folder a upload. user1 should be able download and upload to this folder and no be able to navigate out of this folder. Only user1 should be bale to connect to the ftp server.

I have already followed some guides already out there but could not manage to get it working correctly and would like a clear understanding of user and access permissions for Ubuntu.

Thanks in advance Rob

0

You give to your strictly FTP users no real shell account on the Gnu/Linux system.

Use the following command to create ftp users.

This step must be done for each additional new user you allow to access your FTP server.

sudo su
mkdir /home/ftp
useradd -d /home/ftp/user1/ -s /dev/null user1 > /dev/null 2>&1
passwd user1

The mkdir command will create the ftp directory under the /home directory.

The useradd command will add the new user named user1.

The passwd command will set the password for this user user1.

Edit the /etc/shells file, and add a non-existent shell name like null.

This fake shell will limit access on the system for FTP users.

sudo su
nano /etc/shells      

Content:

# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash

Add line /dev/null, like this:

# /etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
/dev/null

Control + O, save file. Control + X, close nano.

Edit your /etc/passwd file and add manually the /./ line to divide the /home/ftp directory with the /user1 directory where the user user1 should be automatically chdir'd to.

sudo su
nano /etc/passwd

Change:

user1:x:504:504::/home/ftp/user1/:/dev/null 
To
user1:x:504:504::/home/ftp/./user1/:/dev/null 

Control + O, save file. Control + X, close nano.

The account is user1.

The first part /home/ftp/ indicates the filesystem that should be considered their new root directory.

The dot . divides that from the directory they should be automatically chdir'd. change directory'd into, /user1/.

|improve this answer|||||
  • Thanks alot, this really clarified the "user" thing. I got it working along the below allow_writeable_chroot=YES userlist_enable=YES userlist_file=/etc/vsftpd.userlist userlist_deny=NO chroot_local_user=YES One more question, when you specify the dot in the passwd file, can the dot be anywhere? Seem I get the same results if I have the dot before or after user1 Thanks again! I was loosing it with this user thing until you helped me out!!!! :) – Rob Sep 15 '14 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.