Why can't the PCD write to a file on the file system after the file has been written over FTP?
FAQ #101378
After a file has been downloaded from the PC using FTP to the file system of the PCD (and the file has not been present before) the case can occur that the PCD can no longer write into this file (or read from this file).
This situation can be caused by the fact that the file has been created (downloaded) by the FTP user "root".
Symptom
After a file has been downloaded over FTP to the PCD (with the default user "root") this file can no longer be accessed by the user program with e.g. the rights of the "Web Group".
If the PCD user program tries to access such a file (which was copied before from the PC to the PCD) by the FBox "HDLog File" and on the FBox "Memory" the parameter "Group ID" is set to "Web", then the FBox will not allow the access to the file because the group ID of the file is not the same as the group ID specified on the FBox.
This means that the LED of the FBox do switch to red and the error output of the FBox is set to high.
Reason
If the FTP user "root" (default) does access the file system, then all files which are created (moved/copied/generated) do have the group ID set to 0. This behaviour has been introduced in the first firmware versions supporting the FTP Server and have been left this way in order to keep the compatibility.
Solution
To avoid this problem it's necessary to create on the PCD a new FTP user which belongs to the same group ID as defined on the FBox "Memory".
For PG5 2.0 or later:
Defintion of a new FTP user on the device configurator with the follwoing configuration:
# User = sbc_pcd
# password = web_access
# Belong to Web Group.
# Have access to files / directories belonging to all groups except PLC Group
# By default read/write access
For PG5 1.4:
(File FTPCONFIG.TXT which does contain the FTP user and which have to be copied to the folder "config").
Example for the definition of an FTP user with belongs to the group ID "Web" (note that the line "UserName..." must not contain any space characters):
# User = sbc_pcd
# password = web_access
# Belong to Web Group.
# Have access to files / directories belonging to all groups except PLC Group
# By default read/write access
UserName=sbc_pcd,web_access,0x08,0xFE
Remarks
- For security reasons it is recommended not to leave the default user "root" active (because if this is the case, everyone who read the FTP manual can access the file system).
- To figure out the group ID of a file on the PCD file system you have to use the "SBC SD File System Explorer":
Categories
PG5 2.0 / FTP-Server
Local FAQ Deutschland / File System library
PG5 2.0 / File System library
Last update: 26.05.2015 10:36
First release: 23.02.2010 09:38
Views: 8439