How can I create FTP user account, How to Point DocumentRoot (/var/www/html/)?

December 16, 2014 17.5k views

I need to create Directory inside on DocumentRoot. How to set permissions?

I tried vbut getting
Forbidden

You don't have permission to access /mailboxtool/ on this server.

1 comment
5 Answers

For creating FTP accounts I recommend you to first set up a secure FTP with vsftpd: https://www.digitalocean.com/community/tutorials/how-to-set-up-vsftpd-on-ubuntu-12-04.
Each new user you add in Linux will serve to connect as FTP user.

To create a new directory in /var/www/html execute:
cd /var/www/html -> will navigate to the html directory
mkdir your-directory-name -> will create the directory named "your-directory-name"

Thanks for your kind information.

I have a doubt? Normal user account point to default user home directory( /home/user1/). In this case I access FTP through this user it point to /hom/user1/. Can I access apache document root (/var/www/html/new directory/ using this user1 account. I am using Fillzilla client.

I tried, this..

root@digidom:~# apt-get install vsftpd
root@digidom:~# cp /etc/vsftpd.conf /etc/vsftpd.conf.back

root@digidom:~# egrep -v '^#|^$' /etc/vsftpd.conf
listen=YES
anonymousenable=NO
local
enable=YES
writeenable=YES
dirmessage
enable=YES
uselocaltime=YES
xferlog
enable=YES
connectfromport20=YES
secure
chrootdir=/var/run/vsftpd/empty
pam
servicename=vsftpd
rsa
certfile=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa
privatekeyfile=/etc/ssl/private/ssl-cert-snakeoil.key

chrootlocaluser=YES
allowwriteablechroot=YES

root@digidom:~# useradd -m -d /var/www/html/ -s /sbin/nologin mailftp
root@digidom:~# mkdir mailboxtool

root@digidom:/var/www/html# ll
total 32
drwxr-xr-x 3 root root 4096 Dec 15 05:26 ./
drwxr-xr-x 3 root root 4096 Dec 12 10:28 ../
-rw-r--r-- 1 root root 11510 Dec 12 10:28 index.html
drwxr-xr-x 2 root root 4096 Dec 15 05:26 mailboxtool/
-rw-r--r-- 1 root root 23 Dec 12 11:03 phpinfo.php

In this Time I get error "Forbidden You don't have permission to access "

Kindly solve my issue.

Same Question

I can not change user home directory to /var/www/html

how to change user home directory to /var/www/html ??

  • You can change a user's home directory by running the following command:

    sudo usermod -d /path/to/new/home/directory user
    

    If you wish to move all the contents under the user's current home directory to the new one, simply pass the -m option as well to usermod:

    sudo usermod -m -d /path/to/new/home/directory user
    
  • Don't forget to add the username to that usermod command, e.g.:

    sudo usermod -d /path/to/new/home/directory frankie
    
  • Oh, my bad. Thanks @ClockworkHero, I've corrected it :)

how to get list of groups ??

Have another answer? Share your knowledge.