server - Can I make a user's home directory be /var/www/html for vsftp? - Ask Ubuntu


i have ubuntu 16.04 web server. hosts 1 site using nginx. want keep things simple, , store index.html file , whole website in /var/www/html.

i need able ftp files /var/www/html. have installed vsftp. i've created user useradd command, i'll call exampleuser. used command:

sudo usermod -d /var/www/html exampleuser 

... thinking make home directory of exampleuser default directory when log in ftp.

however, when attempt log in ftp, "login error". i've checked , double checked username , password , i'm they're correct, i'm guessing it's permissions issue (also because experience of time in linux when things don't work hoped it's because of permissions). though it's possible vsftpd configurations issue.

i think i've set html directory in /var/www have right access:

/var/www$ ls -la total 12 drwxr-xr-x  3 root          root          4096 nov 10 06:54 . drwxr-xr-x 14 root          root          4096 nov 10 06:54 .. drwxr-xr-x  2 exampleuser exampleuser 4096 nov 10 08:04 html 

what need can ftp /var/www/html?

yes permission error take on tutorial:

ftp more secure when users restricted specific directory.vsftpd accomplishes chroot jails. when chroot enabled local users, restricted home directory default. however, because of way vsftpd secures directory, must not writable user. fine new user should connect via ftp, existing user may need write home folder if shell access.

in example, rather removing write privileges home directory, we're create ftp directory serve chroot , writable files directory hold actual files.

create ftp folder, set ownership, , sure remove write permissions following commands:

sudo mkdir /home/sammy/ftp sudo chown nobody:nogroup /home/sammy/ftp sudo chmod a-w /home/sammy/ftp 

if try connect ftp , user can write folder wont connect, need add root folder owner nobody:nogroup, if want keep things simple point server folder user can write in case:

sudo usermod -d /var/www exampleuser 

this because want write on html folder

sudo chown nobody:nogroup /var/www sudo chmod a-w /var/www 

modify server conf file , point new location html solution helps lot if want use safe ftp


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User