Why doesn't mkfifo with a mode of 1755 grant read permissions and sticky bit to the user?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







6















I'm creating a server and client situation where i want to create a pipe so they can communicate.



I created the pipe in the server code with
mkfifo("fifo",1755);:




  • 1 for only user that created and root to be able to delete it or rename it,

  • 7 for give read, write and exec to user, and

  • 5 for both group and other to only give them read and exec.


The problem is that later in the server code I open the fifo to read from it open("fifo",O_RDONLY); but when i execute it, it shows me an perror that denies me acess to the fifo.



I went to see the permissions of the pipe fifo and it says
p-wx--s--t so:





  • p stands for pipe,


  • - means the user has no read. I don't know how when I gave it with the 7,


  • s group executes has user. I don't how if i gave 1 so supposedly it should give to user and others the ability to only read and execute and others have t that was expected.


Do I have a misunderstanding of the permissions?










share|improve this question









New contributor




Joao Parente is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



























    6















    I'm creating a server and client situation where i want to create a pipe so they can communicate.



    I created the pipe in the server code with
    mkfifo("fifo",1755);:




    • 1 for only user that created and root to be able to delete it or rename it,

    • 7 for give read, write and exec to user, and

    • 5 for both group and other to only give them read and exec.


    The problem is that later in the server code I open the fifo to read from it open("fifo",O_RDONLY); but when i execute it, it shows me an perror that denies me acess to the fifo.



    I went to see the permissions of the pipe fifo and it says
    p-wx--s--t so:





    • p stands for pipe,


    • - means the user has no read. I don't know how when I gave it with the 7,


    • s group executes has user. I don't how if i gave 1 so supposedly it should give to user and others the ability to only read and execute and others have t that was expected.


    Do I have a misunderstanding of the permissions?










    share|improve this question









    New contributor




    Joao Parente is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      6












      6








      6








      I'm creating a server and client situation where i want to create a pipe so they can communicate.



      I created the pipe in the server code with
      mkfifo("fifo",1755);:




      • 1 for only user that created and root to be able to delete it or rename it,

      • 7 for give read, write and exec to user, and

      • 5 for both group and other to only give them read and exec.


      The problem is that later in the server code I open the fifo to read from it open("fifo",O_RDONLY); but when i execute it, it shows me an perror that denies me acess to the fifo.



      I went to see the permissions of the pipe fifo and it says
      p-wx--s--t so:





      • p stands for pipe,


      • - means the user has no read. I don't know how when I gave it with the 7,


      • s group executes has user. I don't how if i gave 1 so supposedly it should give to user and others the ability to only read and execute and others have t that was expected.


      Do I have a misunderstanding of the permissions?










      share|improve this question









      New contributor




      Joao Parente is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I'm creating a server and client situation where i want to create a pipe so they can communicate.



      I created the pipe in the server code with
      mkfifo("fifo",1755);:




      • 1 for only user that created and root to be able to delete it or rename it,

      • 7 for give read, write and exec to user, and

      • 5 for both group and other to only give them read and exec.


      The problem is that later in the server code I open the fifo to read from it open("fifo",O_RDONLY); but when i execute it, it shows me an perror that denies me acess to the fifo.



      I went to see the permissions of the pipe fifo and it says
      p-wx--s--t so:





      • p stands for pipe,


      • - means the user has no read. I don't know how when I gave it with the 7,


      • s group executes has user. I don't how if i gave 1 so supposedly it should give to user and others the ability to only read and execute and others have t that was expected.


      Do I have a misunderstanding of the permissions?







      permissions c mkfifo






      share|improve this question









      New contributor




      Joao Parente is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Joao Parente is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Apr 11 at 17:21









      mosvy

      10.1k11237




      10.1k11237






      New contributor




      Joao Parente is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Apr 11 at 10:01









      Joao ParenteJoao Parente

      333




      333




      New contributor




      Joao Parente is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Joao Parente is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Joao Parente is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          13














          You cannot simply exec a binary from a pipe: Is there a way to execute a native binary from a pipe?. Also I don't think the sticky bit on executables is worth anything on modern systems.




          I created the pipe in the server code with mkfifo("fifo",1755);



          I went to see the permissions of the pipe fifo and it says p-wx--s--t so:




          Your error is to have written the 1755 permission without the leading 0, which means that 1755 has been treated as a decimal instead of octal (1755 & ~022 = 03311 = p-wx--s--t; where 022 is your umask)






          share|improve this answer


























          • So a better solution would be create a dir and chmod 1755 the dir then create the pipe in that dir with ``` mkfifo ("fifo",755); ``` ?

            – Joao Parente
            Apr 11 at 10:19








          • 3





            The sticky bit has different semantics for files and directories: for directories it prevents users from removing or renaming files they don't own; for regular files it doesn't mean much nowadays. Read the chmod(2) manpage for all the details. Also, mkfifo("fifo", 0755) with the leading 0 ;-).

            – mosvy
            Apr 11 at 10:24











          • thanks very much :P

            – Joao Parente
            Apr 11 at 10:26











          • i tried mkfifo("fifo",0777); but i only got prwxr-xr-xbut if i do chmod 0777 fifo after i created fifo i get prwxrwxrwxany idea why it doesnt work when i create it

            – Joao Parente
            Apr 11 at 17:09











          • Because of the umask -- the umask which is 022 will mask out the write permissions from group (020) and other (002) anytime a file is created with open(2), mkfifo(2), etc. Read the umask(2) manpage. The umask doesn't affect the chmod syscall or command.

            – mosvy
            Apr 11 at 17:15












          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Joao Parente is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511874%2fwhy-doesnt-mkfifo-with-a-mode-of-1755-grant-read-permissions-and-sticky-bit-to%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          13














          You cannot simply exec a binary from a pipe: Is there a way to execute a native binary from a pipe?. Also I don't think the sticky bit on executables is worth anything on modern systems.




          I created the pipe in the server code with mkfifo("fifo",1755);



          I went to see the permissions of the pipe fifo and it says p-wx--s--t so:




          Your error is to have written the 1755 permission without the leading 0, which means that 1755 has been treated as a decimal instead of octal (1755 & ~022 = 03311 = p-wx--s--t; where 022 is your umask)






          share|improve this answer


























          • So a better solution would be create a dir and chmod 1755 the dir then create the pipe in that dir with ``` mkfifo ("fifo",755); ``` ?

            – Joao Parente
            Apr 11 at 10:19








          • 3





            The sticky bit has different semantics for files and directories: for directories it prevents users from removing or renaming files they don't own; for regular files it doesn't mean much nowadays. Read the chmod(2) manpage for all the details. Also, mkfifo("fifo", 0755) with the leading 0 ;-).

            – mosvy
            Apr 11 at 10:24











          • thanks very much :P

            – Joao Parente
            Apr 11 at 10:26











          • i tried mkfifo("fifo",0777); but i only got prwxr-xr-xbut if i do chmod 0777 fifo after i created fifo i get prwxrwxrwxany idea why it doesnt work when i create it

            – Joao Parente
            Apr 11 at 17:09











          • Because of the umask -- the umask which is 022 will mask out the write permissions from group (020) and other (002) anytime a file is created with open(2), mkfifo(2), etc. Read the umask(2) manpage. The umask doesn't affect the chmod syscall or command.

            – mosvy
            Apr 11 at 17:15
















          13














          You cannot simply exec a binary from a pipe: Is there a way to execute a native binary from a pipe?. Also I don't think the sticky bit on executables is worth anything on modern systems.




          I created the pipe in the server code with mkfifo("fifo",1755);



          I went to see the permissions of the pipe fifo and it says p-wx--s--t so:




          Your error is to have written the 1755 permission without the leading 0, which means that 1755 has been treated as a decimal instead of octal (1755 & ~022 = 03311 = p-wx--s--t; where 022 is your umask)






          share|improve this answer


























          • So a better solution would be create a dir and chmod 1755 the dir then create the pipe in that dir with ``` mkfifo ("fifo",755); ``` ?

            – Joao Parente
            Apr 11 at 10:19








          • 3





            The sticky bit has different semantics for files and directories: for directories it prevents users from removing or renaming files they don't own; for regular files it doesn't mean much nowadays. Read the chmod(2) manpage for all the details. Also, mkfifo("fifo", 0755) with the leading 0 ;-).

            – mosvy
            Apr 11 at 10:24











          • thanks very much :P

            – Joao Parente
            Apr 11 at 10:26











          • i tried mkfifo("fifo",0777); but i only got prwxr-xr-xbut if i do chmod 0777 fifo after i created fifo i get prwxrwxrwxany idea why it doesnt work when i create it

            – Joao Parente
            Apr 11 at 17:09











          • Because of the umask -- the umask which is 022 will mask out the write permissions from group (020) and other (002) anytime a file is created with open(2), mkfifo(2), etc. Read the umask(2) manpage. The umask doesn't affect the chmod syscall or command.

            – mosvy
            Apr 11 at 17:15














          13












          13








          13







          You cannot simply exec a binary from a pipe: Is there a way to execute a native binary from a pipe?. Also I don't think the sticky bit on executables is worth anything on modern systems.




          I created the pipe in the server code with mkfifo("fifo",1755);



          I went to see the permissions of the pipe fifo and it says p-wx--s--t so:




          Your error is to have written the 1755 permission without the leading 0, which means that 1755 has been treated as a decimal instead of octal (1755 & ~022 = 03311 = p-wx--s--t; where 022 is your umask)






          share|improve this answer















          You cannot simply exec a binary from a pipe: Is there a way to execute a native binary from a pipe?. Also I don't think the sticky bit on executables is worth anything on modern systems.




          I created the pipe in the server code with mkfifo("fifo",1755);



          I went to see the permissions of the pipe fifo and it says p-wx--s--t so:




          Your error is to have written the 1755 permission without the leading 0, which means that 1755 has been treated as a decimal instead of octal (1755 & ~022 = 03311 = p-wx--s--t; where 022 is your umask)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 11 at 10:38

























          answered Apr 11 at 10:18









          mosvymosvy

          10.1k11237




          10.1k11237













          • So a better solution would be create a dir and chmod 1755 the dir then create the pipe in that dir with ``` mkfifo ("fifo",755); ``` ?

            – Joao Parente
            Apr 11 at 10:19








          • 3





            The sticky bit has different semantics for files and directories: for directories it prevents users from removing or renaming files they don't own; for regular files it doesn't mean much nowadays. Read the chmod(2) manpage for all the details. Also, mkfifo("fifo", 0755) with the leading 0 ;-).

            – mosvy
            Apr 11 at 10:24











          • thanks very much :P

            – Joao Parente
            Apr 11 at 10:26











          • i tried mkfifo("fifo",0777); but i only got prwxr-xr-xbut if i do chmod 0777 fifo after i created fifo i get prwxrwxrwxany idea why it doesnt work when i create it

            – Joao Parente
            Apr 11 at 17:09











          • Because of the umask -- the umask which is 022 will mask out the write permissions from group (020) and other (002) anytime a file is created with open(2), mkfifo(2), etc. Read the umask(2) manpage. The umask doesn't affect the chmod syscall or command.

            – mosvy
            Apr 11 at 17:15



















          • So a better solution would be create a dir and chmod 1755 the dir then create the pipe in that dir with ``` mkfifo ("fifo",755); ``` ?

            – Joao Parente
            Apr 11 at 10:19








          • 3





            The sticky bit has different semantics for files and directories: for directories it prevents users from removing or renaming files they don't own; for regular files it doesn't mean much nowadays. Read the chmod(2) manpage for all the details. Also, mkfifo("fifo", 0755) with the leading 0 ;-).

            – mosvy
            Apr 11 at 10:24











          • thanks very much :P

            – Joao Parente
            Apr 11 at 10:26











          • i tried mkfifo("fifo",0777); but i only got prwxr-xr-xbut if i do chmod 0777 fifo after i created fifo i get prwxrwxrwxany idea why it doesnt work when i create it

            – Joao Parente
            Apr 11 at 17:09











          • Because of the umask -- the umask which is 022 will mask out the write permissions from group (020) and other (002) anytime a file is created with open(2), mkfifo(2), etc. Read the umask(2) manpage. The umask doesn't affect the chmod syscall or command.

            – mosvy
            Apr 11 at 17:15

















          So a better solution would be create a dir and chmod 1755 the dir then create the pipe in that dir with ``` mkfifo ("fifo",755); ``` ?

          – Joao Parente
          Apr 11 at 10:19







          So a better solution would be create a dir and chmod 1755 the dir then create the pipe in that dir with ``` mkfifo ("fifo",755); ``` ?

          – Joao Parente
          Apr 11 at 10:19






          3




          3





          The sticky bit has different semantics for files and directories: for directories it prevents users from removing or renaming files they don't own; for regular files it doesn't mean much nowadays. Read the chmod(2) manpage for all the details. Also, mkfifo("fifo", 0755) with the leading 0 ;-).

          – mosvy
          Apr 11 at 10:24





          The sticky bit has different semantics for files and directories: for directories it prevents users from removing or renaming files they don't own; for regular files it doesn't mean much nowadays. Read the chmod(2) manpage for all the details. Also, mkfifo("fifo", 0755) with the leading 0 ;-).

          – mosvy
          Apr 11 at 10:24













          thanks very much :P

          – Joao Parente
          Apr 11 at 10:26





          thanks very much :P

          – Joao Parente
          Apr 11 at 10:26













          i tried mkfifo("fifo",0777); but i only got prwxr-xr-xbut if i do chmod 0777 fifo after i created fifo i get prwxrwxrwxany idea why it doesnt work when i create it

          – Joao Parente
          Apr 11 at 17:09





          i tried mkfifo("fifo",0777); but i only got prwxr-xr-xbut if i do chmod 0777 fifo after i created fifo i get prwxrwxrwxany idea why it doesnt work when i create it

          – Joao Parente
          Apr 11 at 17:09













          Because of the umask -- the umask which is 022 will mask out the write permissions from group (020) and other (002) anytime a file is created with open(2), mkfifo(2), etc. Read the umask(2) manpage. The umask doesn't affect the chmod syscall or command.

          – mosvy
          Apr 11 at 17:15





          Because of the umask -- the umask which is 022 will mask out the write permissions from group (020) and other (002) anytime a file is created with open(2), mkfifo(2), etc. Read the umask(2) manpage. The umask doesn't affect the chmod syscall or command.

          – mosvy
          Apr 11 at 17:15










          Joao Parente is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Joao Parente is a new contributor. Be nice, and check out our Code of Conduct.













          Joao Parente is a new contributor. Be nice, and check out our Code of Conduct.












          Joao Parente is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f511874%2fwhy-doesnt-mkfifo-with-a-mode-of-1755-grant-read-permissions-and-sticky-bit-to%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Plaza Victoria

          Puebla de Zaragoza

          Musa