Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't set group write permissions to created files and directories #586

Open
freepaddler opened this issue Jan 18, 2023 · 16 comments
Open

Comments

@freepaddler
Copy link

It seems that umask 022 is always applied to created files and directories. And it is impossible to set g+w and o+w permissions.

ksmbd.conf:

create mask = 0664
directory mask = 2775
; following options also do not help 
; force create mode = 0664
; force directory mode = 0775

ls -la .

drwxrwsr-x    3 user   storage       4096 Jan 18 18:21 .
drwxr-xr-x    6 root   root          4096 Jan 18 15:31 ..
-rw-r--r--    1 user   storage          2 Mar 30  2022 dummy3.txt
drwxr-sr-x    2 user   storage       4096 Jan 18 18:21 dummy

Alpine Linux 3.17 with 5.15.86 kernel.

@namjaejeon
Copy link
Member

Sorry, where did you command "ls -al" ? mount point ? or share directory ?

@namjaejeon
Copy link
Member

Have you tried "modefromsid" mount option if you have used cifs mount ?

@freepaddler
Copy link
Author

freepaddler commented Jan 20, 2023

Sorry, where did you command "ls -al" ? mount point ? or share directory ?

at share directory (where ksmbd is running)

Have you tried "modefromsid" mount option if you have used cifs mount ?
yep, just tried - the same result

it really behaves as umask 0022, I tried different "create mask" values

@namjaejeon
Copy link
Member

Hm... Stranged.. I also checked it again. but it work fine as expected. what is your local filesystem ?

create mask = 0664

-rw-rw-r--  1 linkinjeon linkinjeon      0  1월 20 14:47  aa
-rw-rw-r--  1 linkinjeon linkinjeon      0  1월 20 14:49  bb
-rw-rw-r--  1 linkinjeon linkinjeon      0  1월 20 14:49  cc

@freepaddler
Copy link
Author

here are system specs:

$ uname -a
Linux alpine2 5.15.88-0-lts #1-Alpine SMP Mon, 16 Jan 2023 08:10:32 +0000 aarch64 Linux
$ head -1 /etc/fstab
UUID=40b62555-076a-4d1d-837f-63e1814d80cc	/	ext4	rw,relatime 0 1
$ ksmbd.mountd -V
ksmbd-tools version : 3.4.6

don't know if it makes sence, but also I checked umask of ksmbd running processess:

  • ksmbd.mount is running with umask 0000 (setup with init.d script)
  • but all ksmbd processes [ksmbd-eth0], [ksmbd-smb_direc], [ksmbd-smb_direc], [ksmbd:*] are running with umask 0022
$ igrep umask /proc/3708/status 
Umask:	0022

@namjaejeon
Copy link
Member

Ah, Okay, Are you using ksmbd in alpine2's linux kernel ? or out of tree ksmbd(cifsd-team/ksmbd) ?
If you are using the one in alpine2's linux kernel, I want to check kernel source.

I am wondering the below patch is in your kernel source...
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/fs/ksmbd/ksmbd_netlink.h?h=v5.15.89&id=8202aa60f077be8977bda2ecd5bd4350a0a5ab1e

@freepaddler
Copy link
Author

Ah, Okay, Are you using ksmbd in alpine2's linux kernel ? or out of tree ksmbd(cifsd-team/ksmbd) ?
If you are using the one in alpine2's linux kernel, I want to check kernel source.

I use ksmbd in alpine2's linux kernel (the default alpine kernel from alpine main repo branch 3.17)

@namjaejeon
Copy link
Member

Hm, Can you check it with out of tree ksmbd here ?

@namjaejeon
Copy link
Member

I can't find it's kernel source or tree. I guess that alpine2's linux kernel doesn't update ksmbd from the latest linux 5.15 stable kernel.

@freepaddler
Copy link
Author

Hm, Can you check it with out of tree ksmbd here ?

tried cifsd-team/ksmbd on 5.15.89 and even 6.1.7 (alpine edge repository) with the same result :(

@namjaejeon
Copy link
Member

Hm.. Don't know.. can you share your ksmb.conf file with me ? want to check it.

@freepaddler
Copy link
Author

Hm.. Don't know.. can you share your ksmb.conf file with me ? want to check it.

# cat /etc/ksmbd/ksmbd.conf
[global]
        ; server settings
        server string = alpine2
        netbios name = alpine2
        workgroup = alpinelab
        interfaces = eth0
        bind interfaces only = yes
        tcp port = 445

        ; share settings              
        root directory = /opt
        guest account = nobody
        map to guest = bad user
        restrict anonymous = 0
        create mask = 0664
        directory mask = 2775
        guest ok = no
        browseable = no
        hide dot files = yes
        ;force user = nobody
        ;force group = nobody
        ;force directory mode = 0777
        ;force create mode = 0777
        ;inherit owner = yes

[user]
    path = /user
    writeable = yes
    valid users = user

@freepaddler
Copy link
Author

Hm.. Don't know.. can you share your ksmb.conf file with me ? want to check it.

just tested on Debian sid Linux deb11 6.1.0-2-arm64 #1 SMP Debian 6.1.7-1 (2023-01-18) aarch64 GNU/Linux
and here it works as expected

also ksmbd processes have umask 0000

# ps afx | grep ksmbd
   1090 ?        S      0:00  \_ [ksmbd-ens160]
   1119 ?        S      0:00  \_ [ksmbd:60445]
   1127 pts/0    S+     0:00          \_ grep ksmbd
   1088 ?        Ss     0:00 ksmbd.mountd -c /etc/ksmbd/ksmbd.conf
   1089 ?        S      0:00  \_ ksmbd.mountd -c /etc/ksmbd/ksmbd.conf

# grep -i umask /proc/{1090,1119}/status
/proc/1090/status:Umask:	0000
/proc/1119/status:Umask:	0000

@namjaejeon
Copy link
Member

@freepaddler Can I understand that there is no problem if you change alpine2 to Debian?

@freepaddler
Copy link
Author

@freepaddler Can I understand that there is no problem if you change alpine2 to Debian?

yep, I raised an issue in Alpinelinux community, thanks for support!

@neheb
Copy link

neheb commented May 15, 2023

Sounds like an issue with ksmbd-tools. musl probably handles the necessary function differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants