Unable to remove or change files after setfacl rwx-command

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












With root-user, I've executed this command:



setfacl -R -d -m u:MYUSER:rwx /myfolder


When I then change to that user ( su MYUSER ) and try to remove a file ( rm /myfolder/somefile.sql then I get the this error:



rm: cannot remove 'somefile.sql': Permission denied


I can't mv it either; then I get this error:



mv: cannot move 'somefile.sql' to 'someotherfile.sql': Permission denied


I've added MYUSER to /etc/sudoers, - so when I run: sudo rm /myfolder/somefile.sql, then I'm prompted for MYUSERs password; and then it works. But I need it to work without sudo, so I can run it as a crontab-job.



If I write getfacl /myfolder, then I get this output:



# file: /myfolder/
# owner: root
# group: root
user::rwx
group::r-x
other::r-x
default:user::rwx
default:user:MYUSER:rwx <-- That looks right, doesn't it?
default:group::r-x
default:mask::rwx
default:other::r-x


... Why in the name of Zeus can't I remove files in this directory?







share|improve this question
























    up vote
    1
    down vote

    favorite












    With root-user, I've executed this command:



    setfacl -R -d -m u:MYUSER:rwx /myfolder


    When I then change to that user ( su MYUSER ) and try to remove a file ( rm /myfolder/somefile.sql then I get the this error:



    rm: cannot remove 'somefile.sql': Permission denied


    I can't mv it either; then I get this error:



    mv: cannot move 'somefile.sql' to 'someotherfile.sql': Permission denied


    I've added MYUSER to /etc/sudoers, - so when I run: sudo rm /myfolder/somefile.sql, then I'm prompted for MYUSERs password; and then it works. But I need it to work without sudo, so I can run it as a crontab-job.



    If I write getfacl /myfolder, then I get this output:



    # file: /myfolder/
    # owner: root
    # group: root
    user::rwx
    group::r-x
    other::r-x
    default:user::rwx
    default:user:MYUSER:rwx <-- That looks right, doesn't it?
    default:group::r-x
    default:mask::rwx
    default:other::r-x


    ... Why in the name of Zeus can't I remove files in this directory?







    share|improve this question






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      With root-user, I've executed this command:



      setfacl -R -d -m u:MYUSER:rwx /myfolder


      When I then change to that user ( su MYUSER ) and try to remove a file ( rm /myfolder/somefile.sql then I get the this error:



      rm: cannot remove 'somefile.sql': Permission denied


      I can't mv it either; then I get this error:



      mv: cannot move 'somefile.sql' to 'someotherfile.sql': Permission denied


      I've added MYUSER to /etc/sudoers, - so when I run: sudo rm /myfolder/somefile.sql, then I'm prompted for MYUSERs password; and then it works. But I need it to work without sudo, so I can run it as a crontab-job.



      If I write getfacl /myfolder, then I get this output:



      # file: /myfolder/
      # owner: root
      # group: root
      user::rwx
      group::r-x
      other::r-x
      default:user::rwx
      default:user:MYUSER:rwx <-- That looks right, doesn't it?
      default:group::r-x
      default:mask::rwx
      default:other::r-x


      ... Why in the name of Zeus can't I remove files in this directory?







      share|improve this question












      With root-user, I've executed this command:



      setfacl -R -d -m u:MYUSER:rwx /myfolder


      When I then change to that user ( su MYUSER ) and try to remove a file ( rm /myfolder/somefile.sql then I get the this error:



      rm: cannot remove 'somefile.sql': Permission denied


      I can't mv it either; then I get this error:



      mv: cannot move 'somefile.sql' to 'someotherfile.sql': Permission denied


      I've added MYUSER to /etc/sudoers, - so when I run: sudo rm /myfolder/somefile.sql, then I'm prompted for MYUSERs password; and then it works. But I need it to work without sudo, so I can run it as a crontab-job.



      If I write getfacl /myfolder, then I get this output:



      # file: /myfolder/
      # owner: root
      # group: root
      user::rwx
      group::r-x
      other::r-x
      default:user::rwx
      default:user:MYUSER:rwx <-- That looks right, doesn't it?
      default:group::r-x
      default:mask::rwx
      default:other::r-x


      ... Why in the name of Zeus can't I remove files in this directory?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 23 at 10:17









      Zeth

      1205




      1205




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          MYUSER is a default owner, but not an effective owner.



          You need to run both



          setfacl -R -d -m u:MYUSER:rwx /myfolder
          setfacl -R -m u:MYUSER:rwx /myfolder


          note second command do not have a default (-d/--default) flag.



          this sould result in getfacl giving



          # file: /myfolder/
          # owner: root
          # group: root
          user::rwx
          user:MYUSER:rwx
          group::r-x
          other::r-x
          default:user::rwx
          default:user:MYUSER:rwx
          default:group::r-x
          default:mask::rwx
          default:other::r-x





          share|improve this answer





























            up vote
            1
            down vote













            setfacl (it's about the same for firewalld) should always be run twice. Once with -d to set the default permissions that will affect newly created files and without it for the actual files.






            share|improve this answer




















              Your Answer







              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "106"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );








               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433030%2funable-to-remove-or-change-files-after-setfacl-rwx-command%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              3
              down vote



              accepted










              MYUSER is a default owner, but not an effective owner.



              You need to run both



              setfacl -R -d -m u:MYUSER:rwx /myfolder
              setfacl -R -m u:MYUSER:rwx /myfolder


              note second command do not have a default (-d/--default) flag.



              this sould result in getfacl giving



              # file: /myfolder/
              # owner: root
              # group: root
              user::rwx
              user:MYUSER:rwx
              group::r-x
              other::r-x
              default:user::rwx
              default:user:MYUSER:rwx
              default:group::r-x
              default:mask::rwx
              default:other::r-x





              share|improve this answer


























                up vote
                3
                down vote



                accepted










                MYUSER is a default owner, but not an effective owner.



                You need to run both



                setfacl -R -d -m u:MYUSER:rwx /myfolder
                setfacl -R -m u:MYUSER:rwx /myfolder


                note second command do not have a default (-d/--default) flag.



                this sould result in getfacl giving



                # file: /myfolder/
                # owner: root
                # group: root
                user::rwx
                user:MYUSER:rwx
                group::r-x
                other::r-x
                default:user::rwx
                default:user:MYUSER:rwx
                default:group::r-x
                default:mask::rwx
                default:other::r-x





                share|improve this answer
























                  up vote
                  3
                  down vote



                  accepted







                  up vote
                  3
                  down vote



                  accepted






                  MYUSER is a default owner, but not an effective owner.



                  You need to run both



                  setfacl -R -d -m u:MYUSER:rwx /myfolder
                  setfacl -R -m u:MYUSER:rwx /myfolder


                  note second command do not have a default (-d/--default) flag.



                  this sould result in getfacl giving



                  # file: /myfolder/
                  # owner: root
                  # group: root
                  user::rwx
                  user:MYUSER:rwx
                  group::r-x
                  other::r-x
                  default:user::rwx
                  default:user:MYUSER:rwx
                  default:group::r-x
                  default:mask::rwx
                  default:other::r-x





                  share|improve this answer














                  MYUSER is a default owner, but not an effective owner.



                  You need to run both



                  setfacl -R -d -m u:MYUSER:rwx /myfolder
                  setfacl -R -m u:MYUSER:rwx /myfolder


                  note second command do not have a default (-d/--default) flag.



                  this sould result in getfacl giving



                  # file: /myfolder/
                  # owner: root
                  # group: root
                  user::rwx
                  user:MYUSER:rwx
                  group::r-x
                  other::r-x
                  default:user::rwx
                  default:user:MYUSER:rwx
                  default:group::r-x
                  default:mask::rwx
                  default:other::r-x






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 23 at 14:28

























                  answered Mar 23 at 11:58









                  Archemar

                  18.9k93366




                  18.9k93366






















                      up vote
                      1
                      down vote













                      setfacl (it's about the same for firewalld) should always be run twice. Once with -d to set the default permissions that will affect newly created files and without it for the actual files.






                      share|improve this answer
























                        up vote
                        1
                        down vote













                        setfacl (it's about the same for firewalld) should always be run twice. Once with -d to set the default permissions that will affect newly created files and without it for the actual files.






                        share|improve this answer






















                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          setfacl (it's about the same for firewalld) should always be run twice. Once with -d to set the default permissions that will affect newly created files and without it for the actual files.






                          share|improve this answer












                          setfacl (it's about the same for firewalld) should always be run twice. Once with -d to set the default permissions that will affect newly created files and without it for the actual files.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 23 at 13:33









                          dev93

                          115




                          115






















                               

                              draft saved


                              draft discarded


























                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433030%2funable-to-remove-or-change-files-after-setfacl-rwx-command%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Popular posts from this blog

                              How to check contact read email or not when send email to Individual?

                              Displaying single band from multi-band raster using QGIS

                              How many registers does an x86_64 CPU actually have?