Page 1 of 2
ftp server - unable to upload files
Posted: Mon Jun 22, 2020 7:14 am
by david_1234
hello ,
I have install ftp server from this page:
https://www.raspberrypi-spy.co.uk/2018/ ... pberry-pi/
it's online ,
I can enter it using filezilla \ cmd
but when I try to upload a file I get error from filezile
Critical file transfer error 553 could not create file
and from the pi server
Code: Select all
Mon Jun 22 10:03:20 2020 [pid 1898] CONNECT: Client "::ffff:10.0.0.1"
Mon Jun 22 10:03:20 2020 [pid 1897] [camera] OK LOGIN: Client "::ffff:10.0.0.1"
Mon Jun 22 10:03:20 2020 [pid 1903] [camera] FAIL MKDIR: Client "::ffff:10.0.0.1", "/X_20200617"
Mon Jun 22 10:03:20 2020 [pid 1903] [camera] FAIL MKDIR: Client "::ffff:10.0.0.1", "/X_JWEV-297158-AEEFC"
Mon Jun 22 10:03:20 2020 [pid 1903] [camera] FAIL UPLOAD: Client "::ffff:10.0.0.1", "/00_D7_14_05_7A_76_JWEV-297158-AEEFC_0_20200617162103_6.jpg", 0.00Kbyte/sec
this is the config file I have done according to the website
Code: Select all
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
chroot_local_user=YES
user_sub_token=$USER
local_root=/mnt/mydisk/$USER/ftp
the camera user is connected to
Code: Select all
groups camera
camera : camera sudo
maybe the problem is in the permissions?
Code: Select all
ls -ls /mnt/mydisk/camera/
total 8
8 drwxr-xr-x 3 root root 8192 Jun 22 09:13 ftp
pi@raspberrypi:~ $ ls -ls /mnt/mydisk/camera/ftp/
total 8
8 drwxr-xr-x 2 root root 8192 Jun 22 09:13 files
can I only read data from the ftp and can't upload ? it this true ?
do I need to chagne the owner \ mode of this libs?
Thanks ,
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 10:32 am
by thagrol
david_1234 wrote: ↑Mon Jun 22, 2020 7:14 am
maybe the problem is in the permissions?
It looks that way
Code: Select all
ls -ls /mnt/mydisk/camera/
total 8
8 drwxr-xr-x 3 root root 8192 Jun 22 09:13 ftp
pi@raspberrypi:~ $ ls -ls /mnt/mydisk/camera/ftp/
total 8
8 drwxr-xr-x 2 root root 8192 Jun 22 09:13 files
can I only read data from the ftp and can't upload ? it this true ?
root can write but no other user can,.
do I need to chagne the owner \ mode of this libs?
Yes, but how you do that depends on the file system on the mounted disc. I'm assuming it's on a mounted external disc as it's under /mnt.
If it's a linux filesystem,
will grant write permission to every user on the system to /mnt/mydisk/camera/ and all files/directories under it.
Want something more secure? Try
Code: Select all
sudo chown -R user:group /mnt/mydisk/camera/
to change owner and group to the ones you want.
If it's not a linux filesystem you'll probably need to tweak your mount options. Post what you're currently using and what the filesystem is.
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 10:59 am
by david_1234
I have try it -didn't work
please take a look :
Code: Select all
sudo -R a+w /mnt/mydisk/
sudo: invalid option -- 'R'
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt]
[-T timeout] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-T
timeout] [-u user] file ...
pi@raspberrypi:~$ sudo chmod -R a+w /mnt/mydisk/
pi@raspberrypi:~$ ls -lh /mnt/mydisk/
total 8.0K
drwxr-xr-x 3 root root 8.0K Jun 22 09:13 camera
pi@raspberrypi:~$ ls -lh /mnt/mydisk/camera/
total 8.0K
drwxr-xr-x 3 root root 8.0K Jun 22 09:13 ftp
I don't have any problem every user can write on this external usb
Thanks,
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 12:02 pm
by thagrol
Sorry, mistake on my part. That should have been
Code: Select all
sudo chmod -R a+w /mnt/mydisk/camera/
If it's a non-lunux (e.g. FAT or NTFS) that command will likely not change anything and not report an error.
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 12:26 pm
by david_1234
ok
when I format , i use this commands
is there any way to check it and make sure ?
if it's not good
tell me what to do and I will format it again
Thanks ,
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 1:09 pm
by thagrol
That's a linux file system so chown and/or chmod will work.
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 1:20 pm
by david_1234
well it doesn't
I have try both commnds , and it still own by user root
and can't copy files because only root have permission to write
Code: Select all
sudo chmod -R a+w /mnt/mydisk/camera/
pi@raspberrypi:~$ ls -lh /mnt/mydisk/camera/
total 8.0K
drwxr-xr-x 3 root root 8.0K Jun 22 09:13 ftp
what is missing ?
thank you ,
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 2:42 pm
by jahboater
david_1234 wrote: ↑Mon Jun 22, 2020 1:20 pm
what is missing ?
Did you do the chown ?
"chown" is short for "change owner".
Code: Select all
sudo chown -R pi /mnt/mydisk/camera
should change the ownership from root to user "pi".
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 2:49 pm
by david_1234
Code: Select all
pi@raspberrypi:~$ sudo chown -R pi /mnt/mydisk/camera
chown: changing ownership of '/mnt/mydisk/camera/ftp/files': Operation not permitted
chown: changing ownership of '/mnt/mydisk/camera/ftp': Operation not permitted
chown: changing ownership of '/mnt/mydisk/camera': Operation not permitted
starnge ,no?
mayeb start the all format procces from start? (unmount , format,mount etc....)
if you think this is a good "save time" solution ,
can you please give the list of commands you want me to do ?
so I will do exactly as you say command by command
Thank you (for your time )
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 3:08 pm
by jahboater
How exactly was this USB disk mounted ?
Sounds like a security thing.
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 3:09 pm
by david_1234
can you explain the question ?
what command do I need to run to give you an answer?
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 3:15 pm
by rpdom
What command did you run to mount the disk?
When it is mounted, could you show the result of the command
That will list the mount attributes of the file system.
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 3:16 pm
by david_1234
sure
Code: Select all
pi@raspberrypi:~$ mount | grep mydisk
/dev/sda1 on /mnt/mydisk type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iochar
set=ascii,shortname=mixed,errors=remount-ro)
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 3:18 pm
by jahboater
david_1234 wrote: ↑Mon Jun 22, 2020 3:16 pm
pi@raspberrypi:~$ mount | grep mydisk
/dev/sda1 on /mnt/mydisk type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iochar
set=ascii,shortname=mixed,errors=remount-ro)
I thought you formatted this disk as ext4 ?
This is crazy.
FAT filesystems do not have file ownership and permissions.
You can get around it with various mount options where the Linux OS "fakes" the credentials for you.
But first you need to understand why its mounted as vfat when you formatted it as ext4 - different disk?
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 4:52 pm
by thagrol
@david_1234
Permissions and ownership of files and directories on FAT filesystems comes up again and again on here (I've answered it myself several times).
Try a forum search, but seach for FAT and/or FAT32 rather than "vfat".
And have a read of the output from the following:
specifically the section on "Mount options for fat"
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 4:53 pm
by thagrol
rpdom wrote: ↑Mon Jun 22, 2020 3:15 pm
What command did you run to mount the disk?
Or if you mounted it by editing /etc/fstab, what did you put in there?
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 5:35 pm
by jahboater
Thagrol,
thagrol wrote: ↑Mon Jun 22, 2020 4:53 pm
Or if you mounted it by editing /etc/fstab, what did you put in there?
The problem is this ....
david_1234 wrote: ↑Mon Jun 22, 2020 12:26 pm
when I format , i use this commands
It was formatted as ext4. So why is it mounted as vfat ???
Different machine, different disk, different universe, who knows

Its sda1 in both cases but that may not mean much.
Re: ftp server - unable to upload files
Posted: Mon Jun 22, 2020 7:15 pm
by thagrol
jahboater wrote: ↑Mon Jun 22, 2020 5:35 pm
Thagrol,
thagrol wrote: ↑Mon Jun 22, 2020 4:53 pm
Or if you mounted it by editing /etc/fstab, what did you put in there?
The problem is this ....
david_1234 wrote: ↑Mon Jun 22, 2020 12:26 pm
when I format , i use this commands
It was formatted as ext4. So why is it mounted as vfat ???
Different machine, different disk, different universe, who knows

Its sda1 in both cases but that may not mean much.
I'm aware of the discrepancy there. I was simply following up on rpdom's request for information. The are more ways to mount a partition than by a mount command. Or via fstab for that matter.
Re: ftp server - unable to upload files
Posted: Tue Jun 23, 2020 5:26 am
by david_1234
I got lose on the way ,what to do ....
I don't mind start from scratch
connect a 16GB disk on key to the pi
I want to be able to use it (copy and write files to it).
so this is what I do
please if you can write in steps what to do , it will be great
Thanks ,
Re: ftp server - unable to upload files
Posted: Tue Jun 23, 2020 11:33 am
by thagrol
david_1234 wrote: ↑Tue Jun 23, 2020 5:26 am
please if you can write in steps what to do , it will be great
Start with these two web pages:
https://www.raspberrypi.org/documentati ... storage.md
https://www.raspberrypi.org/documentati ... s/samba.md
If your drive is any varient of FAT/vfat and you want any/all user to be able to write to it add ",umask=000" after "nofail" when setting up your fstab.
Re: ftp server - unable to upload files
Posted: Tue Jun 23, 2020 3:53 pm
by david_1234
this is what I did:
Code: Select all
sudo lsblk -o UUID,NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL,MODEL
UUID NAME FSTYPE SIZE MOUNTPOINT LABEL MODEL
sda 14.7G DataTraveler_3.0
FAB9-BE75 sda1 vfat 14.7G /mnt/mydisk UBUNTU 16_0
mmcblk0 14.4G
4BBD-D3E7 גגmmcblk0p1 vfat 256M /boot boot
45e99191-771b-4e12-a526-0779148892cb גגmmcblk0p2 ext4 14.2G / rootfs
so I need to use this ?(Because the usb is vfat)
Code: Select all
The FSTYPE column contains the filesystem type. If your storage device uses an exFAT file system, install the exFAT driver:
sudo apt update
sudo apt install exfat-fuse
want to make sure I do it correct
Thanks ,
Re: ftp server - unable to upload files
Posted: Tue Jun 23, 2020 5:19 pm
by thagrol
No. vfat and exfat are not the same and the exfat-fuse driver is not require for vfat.
Re: ftp server - unable to upload files
Posted: Wed Jun 24, 2020 6:17 am
by david_1234
so to use this option?
If your storage device uses an NTFS file system, you will have read-only access to it. If you want to write to the device, you can install the ntfs-3g driver:
sudo apt update
sudo apt install ntfs-3g
I really don't understadn this , so this is why I'm asking all this question (to learn and to make it work )
Thanks,
Re: ftp server - unable to upload files
Posted: Wed Jun 24, 2020 6:23 am
by jahboater
NTFS is a Windows specific filesystem. To use it properly on Linux you must install an extra driver.
Do not use NTFS. For your purposes (an ftp server), ext4 is very much faster, more reliable, and simpler to use.
Also avoid FAT/exFAT as they have no concept of file ownership or permissions, no journal, no extents etc, so they are harder to use, less reliable, and slow.
You know how to format a USB disk as ext4.
Re: ftp server - unable to upload files
Posted: Wed Jun 24, 2020 6:37 am
by david_1234
I don't know - this is why I asking for help in the forum.
I never had to add exteranl to PI
and before I was told to use this explain
https://www.raspberrypi.org/documentati ... storage.md
but you tell me to use ext4 witch is not in the explain
I hav edone this at before
and someone here told me it's not OK
so I don't think it's so hard to understadn and apply what I want to do,
just add the a simple usb and be able to use it (read\write) to all users
can you tell me which command to run?
I'm sure it very simple and easy to do
Thanks,