Notepad++ changes file permission on samba shares



  • Hi,

    I using 7.5.6 on Win 10 and I am editing file on a vmware/samba share.
    When I save the file the file permission will change from 644 to 755.
    I have to change with chmod each file back to default after edit.

    How to avoid this?



  • I don’t have a vmware/samba share, but I do have a samba share, which I access frequently from my Win10 machine.

    On the linux side:
    [1]:~> touch 644.txt ; chmod 644 644.txt
    [2]:~> ls -latr 644.txt
    -rw-r–r-- 1 jonespet workgrp 0 Feb 26 06:43 644.txt

    Then I use the samba share to edit the file in Notepad++ (7.6.3 x64)

    Back on linux, it now says,

    [3]:~> ls -latr 644.txt
    -rw-r--r--  1 jonespet workgrp 18 Feb 26 06:44 644.txt
    

    It didn’t change the permissions for me

    I don’t have a copy of 7.5.6 right now, but I’ve got most of the versions near that one:

    Edited with 7.5.4 x64

    [4]:~> ls -latr 644.txt
    -rw-r--r--  1 jonespet workgrp 447 Feb 26 06:48 644.txt
    

    Edited with 7.5.7 x64

    [5]:~> ls -latr 644.txt
    -rw-r--r--  1 jonespet workgrp 470 Feb 26 06:49 644.txt
    

    Edited with 7.5.5 x32

    [6]:~> ls -latr 644.txt
    -rw-r--r--  1 jonespet workgrp 493 Feb 26 06:50 644.txt
    

    Edited with 7.5.8 x32

    [7]:~> ls -latr 644.txt
    -rw-r--r--  1 jonespet workgrp 516 Feb 26 06:50 644.txt
    

    I am guessing, with having tested versions +/- from the version you listed that such a bug doesn’t exist inherently in 7.5.6, either.

    My guess is the problem lies elsewhere – maybe it’s because the samba share is from vmware; maybe it’s just the way your samba share is configured. I’m not an expert on the server side for setting up samba shares (never done that, just used the ones my IT department set up).

    What happens if you try to edit a file on your samba share from a different editor, like notepad.exe? Do the permissions stay the same, or do they change? If they change using a different editor, then it’s not Notepad++'s fault. If they don’t change in any other editor, but do in Notepad++, then you’ll have to give an exact sequence of events, and supply your ? > Debug Info > Copy debug info into clipboard, because I cannot replicate the problem.



  • before:

    root@ubuntu:~/project/CoreELEC/u-boot# ls  -latr arch/arm/cpu/armv8/g12b/firmware/scp_task/scp_remote.c
    -rw-r--r-- 1 root root 12096 Feb 25 13:25 arch/arm/cpu/armv8/g12b/firmware/scp_task/scp_remote.c
    

    after save with Notepad++:

    root@ubuntu:~/project/CoreELEC/u-boot# ls  -latr arch/arm/cpu/armv8/g12b/firmware/scp_task/scp_remote.c
    -rwxr--r-- 1 root root 12097 Feb 27 15:21 arch/arm/cpu/armv8/g12b/firmware/scp_task/scp_remote.c
    


  • @Stephan-Schwarzbauer

    What you just posted is a repeat of your original post; nothing more and nothing new. Have you considered the other things Peter said in his reply?



  • @Stephan-Schwarzbauer

    Just to be sure this hasn’t been overlooked, samba ignores umask settings.
    It provides its own parameters in smb.conf - at least it did the last time I checked.
    I would bet, that your smb.conf isn’t correctly setup.



  • See patch #8 in my Notepad++ patch collection..

    Don’t know why but the use of fopen/fclose is translated over SAMBA to create new files which get the default permissions while the use of open/close opened existing file for write and truncate which retained its permissions.



  • I added this to the samba share and now it does not change anymore:

    create mask = 0644
    directory mask = 0755
    


  • The question is whether it does not change permissions or change them into the defaults you like.
    Does it keep execute permission for script files you edit?
    If you try to edit with Notepad++ $HOME/.ssh/config which must have no group or all permissions and it turns on RW for them it is still a problem.

    So it is probably good enough workaround but maybe not a complete solution.


Log in to reply