visudo + read access to file from non root user

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











up vote
0
down vote

favorite












how to access the file by visudo from non root user



for example



when we change user to hdfs
and from user hdfs we want to print the file file.cfg we get Permission denied



how to configure the visudo in order to get read access from user hdfs



# su hdfs
$ whoami
hdfs
$ pwd
/opt/home/security
$ cat file.cfg
cat: sec.cfg: Permission denied

$ ls -ltr

-rwxr-----. 1 root root sec.cfg


expected output



# su hdfs
$ pwd
/opt/home/security
cat file.cfg

app_q 384273462 pass BHYVF^GTYR&GV@yhgb2yr






share|improve this question


























    up vote
    0
    down vote

    favorite












    how to access the file by visudo from non root user



    for example



    when we change user to hdfs
    and from user hdfs we want to print the file file.cfg we get Permission denied



    how to configure the visudo in order to get read access from user hdfs



    # su hdfs
    $ whoami
    hdfs
    $ pwd
    /opt/home/security
    $ cat file.cfg
    cat: sec.cfg: Permission denied

    $ ls -ltr

    -rwxr-----. 1 root root sec.cfg


    expected output



    # su hdfs
    $ pwd
    /opt/home/security
    cat file.cfg

    app_q 384273462 pass BHYVF^GTYR&GV@yhgb2yr






    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      how to access the file by visudo from non root user



      for example



      when we change user to hdfs
      and from user hdfs we want to print the file file.cfg we get Permission denied



      how to configure the visudo in order to get read access from user hdfs



      # su hdfs
      $ whoami
      hdfs
      $ pwd
      /opt/home/security
      $ cat file.cfg
      cat: sec.cfg: Permission denied

      $ ls -ltr

      -rwxr-----. 1 root root sec.cfg


      expected output



      # su hdfs
      $ pwd
      /opt/home/security
      cat file.cfg

      app_q 384273462 pass BHYVF^GTYR&GV@yhgb2yr






      share|improve this question














      how to access the file by visudo from non root user



      for example



      when we change user to hdfs
      and from user hdfs we want to print the file file.cfg we get Permission denied



      how to configure the visudo in order to get read access from user hdfs



      # su hdfs
      $ whoami
      hdfs
      $ pwd
      /opt/home/security
      $ cat file.cfg
      cat: sec.cfg: Permission denied

      $ ls -ltr

      -rwxr-----. 1 root root sec.cfg


      expected output



      # su hdfs
      $ pwd
      /opt/home/security
      cat file.cfg

      app_q 384273462 pass BHYVF^GTYR&GV@yhgb2yr








      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 29 '17 at 12:18









      Hauke Laging

      53.6k1282130




      53.6k1282130










      asked Oct 29 '17 at 8:58









      yael

      2,0251145




      2,0251145




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          You need e.g. this line in the sudo configuration:



          hdfs ALL=(ALL) NOPASSWD: /bin/cat /opt/home/security/file.cfg


          and then run these commands:



          su hdfs
          sudo /bin/cat /opt/home/security/file.cfg





          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%2f401175%2fvisudo-read-access-to-file-from-non-root-user%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            You need e.g. this line in the sudo configuration:



            hdfs ALL=(ALL) NOPASSWD: /bin/cat /opt/home/security/file.cfg


            and then run these commands:



            su hdfs
            sudo /bin/cat /opt/home/security/file.cfg





            share|improve this answer
























              up vote
              1
              down vote













              You need e.g. this line in the sudo configuration:



              hdfs ALL=(ALL) NOPASSWD: /bin/cat /opt/home/security/file.cfg


              and then run these commands:



              su hdfs
              sudo /bin/cat /opt/home/security/file.cfg





              share|improve this answer






















                up vote
                1
                down vote










                up vote
                1
                down vote









                You need e.g. this line in the sudo configuration:



                hdfs ALL=(ALL) NOPASSWD: /bin/cat /opt/home/security/file.cfg


                and then run these commands:



                su hdfs
                sudo /bin/cat /opt/home/security/file.cfg





                share|improve this answer












                You need e.g. this line in the sudo configuration:



                hdfs ALL=(ALL) NOPASSWD: /bin/cat /opt/home/security/file.cfg


                and then run these commands:



                su hdfs
                sudo /bin/cat /opt/home/security/file.cfg






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Oct 29 '17 at 12:24









                Hauke Laging

                53.6k1282130




                53.6k1282130



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401175%2fvisudo-read-access-to-file-from-non-root-user%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?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay