1

I have Laravel project on Ubuntu. Project is placed in /var/www/html/myproj. I have my local project on Windows and after some changes I want to upload MyController.php on Ubuntu. From Filezilla I get message: File couldn't be transferred On Ubuntu file is in:

user1@bpl:/var/www/html/myproj/app/Http/Controllers/Admin$ ls -al
total 76
drwxr-xr-x 2 www-data www-data  4096 Mar 13 12:26 .
drwxrwxr-x 4 www-data www-data  4096 Mar 14 21:21 ..
-rw-r--r-- 1 www-data www-data  1170 Mar 13 12:26 AuthController.php

For uploading I user ftpuser1, this user is added to www-data group:

user1@bpl:/var/www/html/myproj$ getent group www-data
www-data:x:33:user1,ftpuser1

Home directory of ftpuser1 is:

user1@bpl:/var/www/html/myproj$ eval echo ~ftpuser1
/var/www/html/

vsftpd works, there is no problem with ftp deamon, because generally I can upload files via Filezilla, I have problem with upload files into Laravel project into Admin directory

user1@bpl:/var/www/html/myproj$ systemctl status vsftpd
● vsftpd.service - vsftpd FTP server
   Loaded: loaded (/lib/systemd/system/vsftpd.service; enabled; vendor preset: e
   Active: active (running) since Thu 2021-03-11 18:23:37 UTC; 3 days ago
 Main PID: 1073 (vsftpd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/vsftpd.service
           └─1073 /usr/sbin/vsftpd /etc/vsftpd.conf

This is response in Filezilla from server:

Command:    PASV
Response:   227 Entering Passive Mode (185,163,47,161,39,70).
Command:    STOR AuthController.php
Response:   553 Could not create file.
Error:  Critical file transfer error
Status: Retrieving directory listing of "/myproj/app/Http/Controllers/Admin"...

On this website, I've found article who permissions for Laravel files should be set: Laravel files on Ubuntu permissions

and it is described that for file permission should be 644 the same as I have:

Then you set all your directories to 755 and your files to 644... SET file permissions

sudo find /path/to/your/laravel/root/directory -type f -exec chmod 644 {} \;

SET directory permissions

sudo find /path/to/your/laravel/root/directory -type d -exec chmod 755 {} \;

but this configuration don't allow upload files using Filezilla and vsftpd

4
  • What ftp daemon do you use on Ubuntu? Or do you want to use sftp? Is vsftpd up and running on your Ubunu? Please run 'systemctl status vsftpd' and post output here. Mar 15, 2021 at 10:56
  • @ThomasAichinger I added response in question
    – Robert
    Mar 15, 2021 at 11:01
  • Ok, then it is a file permission problem. Where (full path) do you want to store the file? What owner and what permission does this directory have? Mar 17, 2021 at 15:04
  • I uploading files into /var/www/myproject directory, I think that permissions shold be chmod 664 not 644, when I changed on 664 I can upload without problem
    – Robert
    Mar 18, 2021 at 19:31

2 Answers 2

2

Change the permissions of upload dir

chmod 664 /var/www/myproject
0

I checked and found my recursive directory of ftp home directory was with root owner, So just changed the permission.

$sudo chown -R ftp1:ftp1 /home/ftp1
$sudo chmod -R 777 /home/ftp1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .