Which permissions do I need in order to send someone else / root files?












0















So I was playing a little with permissions in my system and then I noticed there is no permission specified for sending the file somewhere else.



I tried, as a simple user, the following command:
mail -a //etc/shadow myAddress@domain.com
I was satisfied to get a Permission Denied message, but it's still not clear what the permissions are required in order to send a file.



I mean, I use the mail command for mail protocol, but what about other commands or other protocols?



btw, the permissions for the shadow file were:



-rw-r-----   1 root  shadow    1759 Oct 23  2017 shadow









share|improve this question





























    0















    So I was playing a little with permissions in my system and then I noticed there is no permission specified for sending the file somewhere else.



    I tried, as a simple user, the following command:
    mail -a //etc/shadow myAddress@domain.com
    I was satisfied to get a Permission Denied message, but it's still not clear what the permissions are required in order to send a file.



    I mean, I use the mail command for mail protocol, but what about other commands or other protocols?



    btw, the permissions for the shadow file were:



    -rw-r-----   1 root  shadow    1759 Oct 23  2017 shadow









    share|improve this question



























      0












      0








      0








      So I was playing a little with permissions in my system and then I noticed there is no permission specified for sending the file somewhere else.



      I tried, as a simple user, the following command:
      mail -a //etc/shadow myAddress@domain.com
      I was satisfied to get a Permission Denied message, but it's still not clear what the permissions are required in order to send a file.



      I mean, I use the mail command for mail protocol, but what about other commands or other protocols?



      btw, the permissions for the shadow file were:



      -rw-r-----   1 root  shadow    1759 Oct 23  2017 shadow









      share|improve this question
















      So I was playing a little with permissions in my system and then I noticed there is no permission specified for sending the file somewhere else.



      I tried, as a simple user, the following command:
      mail -a //etc/shadow myAddress@domain.com
      I was satisfied to get a Permission Denied message, but it's still not clear what the permissions are required in order to send a file.



      I mean, I use the mail command for mail protocol, but what about other commands or other protocols?



      btw, the permissions for the shadow file were:



      -rw-r-----   1 root  shadow    1759 Oct 23  2017 shadow






      permissions email






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 3 mins ago









      Community

      1




      1










      asked 11 hours ago









      Z E NirZ E Nir

      56119




      56119






















          1 Answer
          1






          active

          oldest

          votes


















          3














          There isn't one, because "sending" a file isn't really a filesystem-level operation. What the mail command does, is that it opens the file for reading, reads the data, and sends (writes) it over the network socket (probably encoded in the case of email, not that it matters). Similarly, an FTP client, scp, or any other would do the same, they'd read the file as usual.



          You don't have read access to /etc/shadow, so mail running with your user id cannot open it for reading.



          Linux does have the sendfile() system call, which directly copies data between two file descriptors, but that's basically the same as calling read() on the one and write() on the other fd, except that it happens within the kernel so there's less system call overhead. It, too, requires the source to be opened for reading.






          share|improve this answer



















          • 1





            So you claim I can send a file if and only if I got reading permissions?

            – Z E Nir
            11 hours ago








          • 1





            @ZENir That is correct. You have to be able to read a file in order to send it.

            – Tripp Kinetics
            10 hours ago











          • Thank you both!

            – Z E Nir
            10 hours ago











          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
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500199%2fwhich-permissions-do-i-need-in-order-to-send-someone-else-root-files%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









          3














          There isn't one, because "sending" a file isn't really a filesystem-level operation. What the mail command does, is that it opens the file for reading, reads the data, and sends (writes) it over the network socket (probably encoded in the case of email, not that it matters). Similarly, an FTP client, scp, or any other would do the same, they'd read the file as usual.



          You don't have read access to /etc/shadow, so mail running with your user id cannot open it for reading.



          Linux does have the sendfile() system call, which directly copies data between two file descriptors, but that's basically the same as calling read() on the one and write() on the other fd, except that it happens within the kernel so there's less system call overhead. It, too, requires the source to be opened for reading.






          share|improve this answer



















          • 1





            So you claim I can send a file if and only if I got reading permissions?

            – Z E Nir
            11 hours ago








          • 1





            @ZENir That is correct. You have to be able to read a file in order to send it.

            – Tripp Kinetics
            10 hours ago











          • Thank you both!

            – Z E Nir
            10 hours ago
















          3














          There isn't one, because "sending" a file isn't really a filesystem-level operation. What the mail command does, is that it opens the file for reading, reads the data, and sends (writes) it over the network socket (probably encoded in the case of email, not that it matters). Similarly, an FTP client, scp, or any other would do the same, they'd read the file as usual.



          You don't have read access to /etc/shadow, so mail running with your user id cannot open it for reading.



          Linux does have the sendfile() system call, which directly copies data between two file descriptors, but that's basically the same as calling read() on the one and write() on the other fd, except that it happens within the kernel so there's less system call overhead. It, too, requires the source to be opened for reading.






          share|improve this answer



















          • 1





            So you claim I can send a file if and only if I got reading permissions?

            – Z E Nir
            11 hours ago








          • 1





            @ZENir That is correct. You have to be able to read a file in order to send it.

            – Tripp Kinetics
            10 hours ago











          • Thank you both!

            – Z E Nir
            10 hours ago














          3












          3








          3







          There isn't one, because "sending" a file isn't really a filesystem-level operation. What the mail command does, is that it opens the file for reading, reads the data, and sends (writes) it over the network socket (probably encoded in the case of email, not that it matters). Similarly, an FTP client, scp, or any other would do the same, they'd read the file as usual.



          You don't have read access to /etc/shadow, so mail running with your user id cannot open it for reading.



          Linux does have the sendfile() system call, which directly copies data between two file descriptors, but that's basically the same as calling read() on the one and write() on the other fd, except that it happens within the kernel so there's less system call overhead. It, too, requires the source to be opened for reading.






          share|improve this answer













          There isn't one, because "sending" a file isn't really a filesystem-level operation. What the mail command does, is that it opens the file for reading, reads the data, and sends (writes) it over the network socket (probably encoded in the case of email, not that it matters). Similarly, an FTP client, scp, or any other would do the same, they'd read the file as usual.



          You don't have read access to /etc/shadow, so mail running with your user id cannot open it for reading.



          Linux does have the sendfile() system call, which directly copies data between two file descriptors, but that's basically the same as calling read() on the one and write() on the other fd, except that it happens within the kernel so there's less system call overhead. It, too, requires the source to be opened for reading.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 11 hours ago









          ilkkachuilkkachu

          58.6k891165




          58.6k891165








          • 1





            So you claim I can send a file if and only if I got reading permissions?

            – Z E Nir
            11 hours ago








          • 1





            @ZENir That is correct. You have to be able to read a file in order to send it.

            – Tripp Kinetics
            10 hours ago











          • Thank you both!

            – Z E Nir
            10 hours ago














          • 1





            So you claim I can send a file if and only if I got reading permissions?

            – Z E Nir
            11 hours ago








          • 1





            @ZENir That is correct. You have to be able to read a file in order to send it.

            – Tripp Kinetics
            10 hours ago











          • Thank you both!

            – Z E Nir
            10 hours ago








          1




          1





          So you claim I can send a file if and only if I got reading permissions?

          – Z E Nir
          11 hours ago







          So you claim I can send a file if and only if I got reading permissions?

          – Z E Nir
          11 hours ago






          1




          1





          @ZENir That is correct. You have to be able to read a file in order to send it.

          – Tripp Kinetics
          10 hours ago





          @ZENir That is correct. You have to be able to read a file in order to send it.

          – Tripp Kinetics
          10 hours ago













          Thank you both!

          – Z E Nir
          10 hours ago





          Thank you both!

          – Z E Nir
          10 hours ago


















          draft saved

          draft discarded




















































          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%2f500199%2fwhich-permissions-do-i-need-in-order-to-send-someone-else-root-files%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

          Entries order in /etc/network/interfaces

          新発田市

          Grub takes very long (several minutes) to open Menu (in Multi-Boot-System)