Latest News:
*New 11.2 series Release:
2019-06-20: XigmaNAS 11.2.0.4.6766 - released!

*New 12.0 series Release:
2019-06-20: XigmaNAS 12.0.0.4.6766 - released!

We really need "Your" help on XigmaNAS https://translations.launchpad.net/xigmanas translations. Please help today!

Producing and hosting XigmaNAS costs money Please consider donating for our project so that we can continue to offer you the best.
We need your support! eg: PAYPAL

FTP create mask permissions

File transfer protocol.
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
fpermissions
NewUser
NewUser
Posts: 2
Joined: 13 Nov 2016 04:47
Status: Offline

FTP create mask permissions

#1

Post by fpermissions » 13 Nov 2016 04:59

So, I've set up an FTP server in addition to SMB. The files created with the SMB service all have permissions 0766 and are owned by 21. The folders are: 0777.

The problem is that whenever I upload something via FTP, it always sets the permissions to 600 even though it says "file creation mask" 077 and "directory mask" 022 in the settings. This prevents me from accessing these files from the SMB share.

What I want to do is have the FTP uploaded files have the exact same permissions and owner as the SMB files. What do I need to change?

Thanks!

User avatar
raulfg3
Site Admin
Site Admin
Posts: 4914
Joined: 22 Jun 2012 22:13
Location: Madrid (ESPAÑA)
Contact:
Status: Offline

Re: FTP create mask permissions

#2

Post by raulfg3 » 13 Nov 2016 07:56

fpermissions wrote:So, I've set up an FTP server in addition to SMB. The files created with the SMB service all have permissions 0766 and are owned by 21. The folders are: 0777.

The problem is that whenever I upload something via FTP, it always sets the permissions to 600 even though it says "file creation mask" 077 and "directory mask" 022 in the settings. This prevents me from accessing these files from the SMB share.

What I want to do is have the FTP uploaded files have the exact same permissions and owner as the SMB files. What do I need to change?

Thanks!
use 002 as file creation mask
and 000 as folder creation mask

and repeat test.
12.0.0.4 - BETA (revision 6625)+OBI on SUPERMICRO X8SIL-F 8GB of ECC RAM, 12x3TB disk in 3 vdev in RaidZ1 = 32TB Raw size only 22TB usable

Wiki
Last changes
Old Wiki

fpermissions
NewUser
NewUser
Posts: 2
Joined: 13 Nov 2016 04:47
Status: Offline

Re: FTP create mask permissions

#3

Post by fpermissions » 15 Nov 2016 11:22

That is better, but the file is read only when it is accessed through SMB.

User avatar
raulfg3
Site Admin
Site Admin
Posts: 4914
Joined: 22 Jun 2012 22:13
Location: Madrid (ESPAÑA)
Contact:
Status: Offline

Re: FTP create mask permissions

#4

Post by raulfg3 » 15 Nov 2016 11:43

use 0000 as file creation mask and your file are 777 (all can read).

But please revise the user that you use to access by SMB, and add to ftp grop and no need to use 0000 as file creation mask
12.0.0.4 - BETA (revision 6625)+OBI on SUPERMICRO X8SIL-F 8GB of ECC RAM, 12x3TB disk in 3 vdev in RaidZ1 = 32TB Raw size only 22TB usable

Wiki
Last changes
Old Wiki

User avatar
gomario
Starter
Starter
Posts: 69
Joined: 17 Dec 2016 08:45
Status: Offline

Re: FTP create mask permissions

#5

Post by gomario » 25 Feb 2018 18:55

Sorry for reviving this old thread but I too have issues with creating the correct FTP mask. How exactly does this work. Where can I read more about it. 000 for File Creation does make the file readable over the SMB but I can not delete them. Because I access from multiple cellphones (public files), it is not viable to add all the users to the FTP group. What would happen if I make both '000'? (File Creation and Directory Creation)

User avatar
ms49434
Developer
Developer
Posts: 660
Joined: 03 Sep 2015 18:49
Location: Neuenkirchen-Vörden, Germany - GMT+1
Contact:
Status: Offline

Re: FTP create mask permissions

#6

Post by ms49434 » 25 Feb 2018 19:40

gomario wrote:
25 Feb 2018 18:55
Sorry for reviving this old thread but I too have issues with creating the correct FTP mask. How exactly does this work. Where can I read more about it. 000 for File Creation does make the file readable over the SMB but I can not delete them. Because I access from multiple cellphones (public files), it is not viable to add all the users to the FTP group. What would happen if I make both '000'? (File Creation and Directory Creation)
The magic word is umask, have a read here: https://en.wikipedia.org/wiki/Umask
1) XigmaNAS 12.0.0.4 amd64-embedded on a Dell T20 running in a VM on ESXi 6.7U2, 22GB out of 32GB ECC RAM, LSI 9300-8i IT mode in passthrough mode. Pool 1: 2x HGST 10TB, mirrored, SLOG: Samsung 850 Pro, L2ARC: Samsung 850 Pro, Pool 2: 1x Samsung 860 EVO 1TB , services: Samba AD, CIFS/SMB, ftp, ctld, rsync, syncthing, zfs snapshots.
2) XigmaNAS 12.0.0.4 amd64-embedded on a Dell T20 running in a VM on ESXi 6.7U2, 8GB out of 32GB ECC RAM, IBM M1215 crossflashed, IT mode, passthrough mode, 2x HGST 10TB , services: rsync.

User avatar
gomario
Starter
Starter
Posts: 69
Joined: 17 Dec 2016 08:45
Status: Offline

Re: FTP create mask permissions

#7

Post by gomario » 26 Feb 2018 15:39

ms49434 wrote:
25 Feb 2018 19:40
gomario wrote:
25 Feb 2018 18:55
Sorry for reviving this old thread but I too have issues with creating the correct FTP mask. How exactly does this work. Where can I read more about it. 000 for File Creation does make the file readable over the SMB but I can not delete them. Because I access from multiple cellphones (public files), it is not viable to add all the users to the FTP group. What would happen if I make both '000'? (File Creation and Directory Creation)
The magic word is umask, have a read here: https://en.wikipedia.org/wiki/Umask
Wow . . . a big THANK YOU to ms49434 for the above posted link. I recommend it to anyone reading this thread. Go have a look at that wiki. Is not to complicated to understand and it gives you just about all the info you'll need to properly setup your FTP system.
+1

taltamir
NewUser
NewUser
Posts: 7
Joined: 18 Mar 2013 23:59
Status: Offline

Re: FTP create mask permissions

#8

Post by taltamir » 28 Apr 2019 21:49

ms49434 wrote:
25 Feb 2018 19:40
gomario wrote:
25 Feb 2018 18:55
Sorry for reviving this old thread but I too have issues with creating the correct FTP mask. How exactly does this work. Where can I read more about it. 000 for File Creation does make the file readable over the SMB but I can not delete them. Because I access from multiple cellphones (public files), it is not viable to add all the users to the FTP group. What would happen if I make both '000'? (File Creation and Directory Creation)
The magic word is umask, have a read here: https://en.wikipedia.org/wiki/Umask
Ok, thank for the link. Some testing lead me to the conclusion that this appears to be using octal notation from the wikipedia link given

Folder permissions works exact as explained there... but file permissions are weird.

File claims the default is "077" without specifying it is octal instead of numeric notation.
leaving it blank creates files with permission of rw------- which is 177 in octal.

Going through a bunch of possible octal options for files I get:
Putting 000 for file gives files uploaded via FTP the permissions of rw-rw-rw-. which is 111 in octal
Putting 111 for file also gives rw-rw-rw- which is octal 111.
Putting 222 for file gives r--r--r-- which is octal 333
Putting 333 for file gives r--r--r-- which is octal 333
Putting 444 for file gives -w--w--w- which is octal 555
Putting 555 for file gives -w--w--w- which is octal 555
Putting 666 for file gives --------- which is octal 777
Putting 777 for file gives --------- which is octal 777

Looking at the pattern, it seems that any permission is given is automatically changed to disable execute permission. Anyone knows why it is doing that and how I can overrule it?

User avatar
ms49434
Developer
Developer
Posts: 660
Joined: 03 Sep 2015 18:49
Location: Neuenkirchen-Vörden, Germany - GMT+1
Contact:
Status: Offline

Re: FTP create mask permissions

#9

Post by ms49434 » 29 Apr 2019 01:14

taltamir wrote:
28 Apr 2019 21:49
ms49434 wrote:
25 Feb 2018 19:40
gomario wrote:
25 Feb 2018 18:55
Sorry for reviving this old thread but I too have issues with creating the correct FTP mask. How exactly does this work. Where can I read more about it. 000 for File Creation does make the file readable over the SMB but I can not delete them. Because I access from multiple cellphones (public files), it is not viable to add all the users to the FTP group. What would happen if I make both '000'? (File Creation and Directory Creation)
The magic word is umask, have a read here: https://en.wikipedia.org/wiki/Umask
Ok, thank for the link. Some testing lead me to the conclusion that this appears to be using octal notation from the wikipedia link given

Folder permissions works exact as explained there... but file permissions are weird.

File claims the default is "077" without specifying it is octal instead of numeric notation.
leaving it blank creates files with permission of rw------- which is 177 in octal.

Going through a bunch of possible octal options for files I get:
Putting 000 for file gives files uploaded via FTP the permissions of rw-rw-rw-. which is 111 in octal
Putting 111 for file also gives rw-rw-rw- which is octal 111.
Putting 222 for file gives r--r--r-- which is octal 333
Putting 333 for file gives r--r--r-- which is octal 333
Putting 444 for file gives -w--w--w- which is octal 555
Putting 555 for file gives -w--w--w- which is octal 555
Putting 666 for file gives --------- which is octal 777
Putting 777 for file gives --------- which is octal 777

Looking at the pattern, it seems that any permission is given is automatically changed to disable execute permission. Anyone knows why it is doing that and how I can overrule it?
umask is not to blame because it doesn't add permissions by setting flags, it only removes (masks) matching flags.
The explanation is simple: the program which creates the file sets the rw flags but does not the set the executable flag (which is POSIX compliant).
You might want to look into setuid/setgid permissions for file ownership (Permissions) and into configuring default ACL's (Access Control Lists).
1) XigmaNAS 12.0.0.4 amd64-embedded on a Dell T20 running in a VM on ESXi 6.7U2, 22GB out of 32GB ECC RAM, LSI 9300-8i IT mode in passthrough mode. Pool 1: 2x HGST 10TB, mirrored, SLOG: Samsung 850 Pro, L2ARC: Samsung 850 Pro, Pool 2: 1x Samsung 860 EVO 1TB , services: Samba AD, CIFS/SMB, ftp, ctld, rsync, syncthing, zfs snapshots.
2) XigmaNAS 12.0.0.4 amd64-embedded on a Dell T20 running in a VM on ESXi 6.7U2, 8GB out of 32GB ECC RAM, IBM M1215 crossflashed, IT mode, passthrough mode, 2x HGST 10TB , services: rsync.

taltamir
NewUser
NewUser
Posts: 7
Joined: 18 Mar 2013 23:59
Status: Offline

Re: FTP create mask permissions

#10

Post by taltamir » 29 Apr 2019 18:45

ms49434 wrote:
29 Apr 2019 01:14
umask is not to blame because it doesn't add permissions by setting flags, it only removes (masks) matching flags.
The explanation is simple: the program which creates the file sets the rw flags but does not the set the executable flag (which is POSIX compliant).
You might want to look into setuid/setgid permissions for file ownership (Permissions) and into configuring default ACL's (Access Control Lists).
Ok, so the GUI can only strip permissions after the fact via calling umask.
I need to set all masks in FTP GUI to 000 so it doesn't strip any permissions after the fact. Then use CLI commands to actually set the actual permissions on file creation. Is that correct?

I looked at those links, and I am not sure how exactly I am supposed to fix it. I tried using using uid via
$ chmod -R 4777 /mnt/vids/vids_share/FTP/test
to set the FTP upload directory to have all permissions with the owner being the directory owner instead of the uploading process.

I checked using
$ getfacl -d /mnt/vids/vids_share/FTP
and it is telling me that no ACL default exists for that directory. So it shouldn't be ACL that is causing the problem.

So I am really not sure what I am supposed to do to make it work

Post Reply

Return to “FTP”