Is it possible to create a directory and file inside /proc/sys?

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











up vote
9
down vote

favorite
1












I am running CentOS 6.2 and I need to create a subdirectory named "crypto" inside /proc/sys. Inside /proc/sys/crypto, I need to create a file named test which contains the value "1".










share|improve this question























  • As per the other two answers, /proc/ is a virtual filesystem. /proc/sys/crypto should appear magically the instant the kernel loads a driver that uses it. I suspect that you're actually missing something else -- can you elaborate as to what you're doing that tells you to create that file?
    – Shadur
    May 10 '12 at 6:46














up vote
9
down vote

favorite
1












I am running CentOS 6.2 and I need to create a subdirectory named "crypto" inside /proc/sys. Inside /proc/sys/crypto, I need to create a file named test which contains the value "1".










share|improve this question























  • As per the other two answers, /proc/ is a virtual filesystem. /proc/sys/crypto should appear magically the instant the kernel loads a driver that uses it. I suspect that you're actually missing something else -- can you elaborate as to what you're doing that tells you to create that file?
    – Shadur
    May 10 '12 at 6:46












up vote
9
down vote

favorite
1









up vote
9
down vote

favorite
1






1





I am running CentOS 6.2 and I need to create a subdirectory named "crypto" inside /proc/sys. Inside /proc/sys/crypto, I need to create a file named test which contains the value "1".










share|improve this question















I am running CentOS 6.2 and I need to create a subdirectory named "crypto" inside /proc/sys. Inside /proc/sys/crypto, I need to create a file named test which contains the value "1".







centos proc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 at 9:26









Rui F Ribeiro

38.2k1475123




38.2k1475123










asked May 9 '12 at 20:48









Idinahui

4612




4612











  • As per the other two answers, /proc/ is a virtual filesystem. /proc/sys/crypto should appear magically the instant the kernel loads a driver that uses it. I suspect that you're actually missing something else -- can you elaborate as to what you're doing that tells you to create that file?
    – Shadur
    May 10 '12 at 6:46
















  • As per the other two answers, /proc/ is a virtual filesystem. /proc/sys/crypto should appear magically the instant the kernel loads a driver that uses it. I suspect that you're actually missing something else -- can you elaborate as to what you're doing that tells you to create that file?
    – Shadur
    May 10 '12 at 6:46















As per the other two answers, /proc/ is a virtual filesystem. /proc/sys/crypto should appear magically the instant the kernel loads a driver that uses it. I suspect that you're actually missing something else -- can you elaborate as to what you're doing that tells you to create that file?
– Shadur
May 10 '12 at 6:46




As per the other two answers, /proc/ is a virtual filesystem. /proc/sys/crypto should appear magically the instant the kernel loads a driver that uses it. I suspect that you're actually missing something else -- can you elaborate as to what you're doing that tells you to create that file?
– Shadur
May 10 '12 at 6:46










2 Answers
2






active

oldest

votes

















up vote
6
down vote













/proc is a virtual filesystem. You will need to write a kernel module that creates the appropriate structures within it.






share|improve this answer




















  • Could you give me more details on it, i am not linux person you got step by step solution? I bet it just mounts some other directory then?
    – user18567
    May 9 '12 at 21:55






  • 2




    IBM Developerworks even has a tutorial on how to do this: ibm.com/developerworks/linux/library/l-proc/index.html I know this worked, once upon a time, can't recall if it was 2.4 or 2.6 kernel...
    – Bruce Ediger
    May 9 '12 at 22:39

















up vote
5
down vote













Ignacio Vazquez-Abrams's answer is correct: files under /proc and /sys are provided by the kernel. If you want to add a file there, write a kernel module. You can find a slightly dated presentation of the /proc programming interface in Linux Device Drivers 3rd ed. ch. 4.



Technically, it is possible to jump through hoops to make a file appear in /proc/sys/crypto (or anywhere else, really). Make a bind mount from /proc/sys/crypto to a staging directory, and make a union mount of the staging directory and an overlay directory back onto /proc/sys/crypto. Here's an example using unionfs-fuse.



# mkdir /tmp/original /tmp/overlay
# mount --bind /proc/sys/crypto /tmp/original
# unionfs-fuse -o nonempty /tmp/overlay=RW:/tmp/original=RO /proc/sys/crypto
# echo hello >/proc/sys/crypto/test
# cat /proc/sys/crypto/test
hello
# umount /proc/sys/crypto
# umount /proc/sys/crypto
# cat /tmp/overlay/test
hello


Note: I disclaim any responsibility for system or brain damage caused by experimenting with this stuff. The commands above are perfectly safe, but messing with other areas of /sys and /proc can cause weird behavior.






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: 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%2f38267%2fis-it-possible-to-create-a-directory-and-file-inside-proc-sys%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    6
    down vote













    /proc is a virtual filesystem. You will need to write a kernel module that creates the appropriate structures within it.






    share|improve this answer




















    • Could you give me more details on it, i am not linux person you got step by step solution? I bet it just mounts some other directory then?
      – user18567
      May 9 '12 at 21:55






    • 2




      IBM Developerworks even has a tutorial on how to do this: ibm.com/developerworks/linux/library/l-proc/index.html I know this worked, once upon a time, can't recall if it was 2.4 or 2.6 kernel...
      – Bruce Ediger
      May 9 '12 at 22:39














    up vote
    6
    down vote













    /proc is a virtual filesystem. You will need to write a kernel module that creates the appropriate structures within it.






    share|improve this answer




















    • Could you give me more details on it, i am not linux person you got step by step solution? I bet it just mounts some other directory then?
      – user18567
      May 9 '12 at 21:55






    • 2




      IBM Developerworks even has a tutorial on how to do this: ibm.com/developerworks/linux/library/l-proc/index.html I know this worked, once upon a time, can't recall if it was 2.4 or 2.6 kernel...
      – Bruce Ediger
      May 9 '12 at 22:39












    up vote
    6
    down vote










    up vote
    6
    down vote









    /proc is a virtual filesystem. You will need to write a kernel module that creates the appropriate structures within it.






    share|improve this answer












    /proc is a virtual filesystem. You will need to write a kernel module that creates the appropriate structures within it.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered May 9 '12 at 21:47









    Ignacio Vazquez-Abrams

    32.7k66980




    32.7k66980











    • Could you give me more details on it, i am not linux person you got step by step solution? I bet it just mounts some other directory then?
      – user18567
      May 9 '12 at 21:55






    • 2




      IBM Developerworks even has a tutorial on how to do this: ibm.com/developerworks/linux/library/l-proc/index.html I know this worked, once upon a time, can't recall if it was 2.4 or 2.6 kernel...
      – Bruce Ediger
      May 9 '12 at 22:39
















    • Could you give me more details on it, i am not linux person you got step by step solution? I bet it just mounts some other directory then?
      – user18567
      May 9 '12 at 21:55






    • 2




      IBM Developerworks even has a tutorial on how to do this: ibm.com/developerworks/linux/library/l-proc/index.html I know this worked, once upon a time, can't recall if it was 2.4 or 2.6 kernel...
      – Bruce Ediger
      May 9 '12 at 22:39















    Could you give me more details on it, i am not linux person you got step by step solution? I bet it just mounts some other directory then?
    – user18567
    May 9 '12 at 21:55




    Could you give me more details on it, i am not linux person you got step by step solution? I bet it just mounts some other directory then?
    – user18567
    May 9 '12 at 21:55




    2




    2




    IBM Developerworks even has a tutorial on how to do this: ibm.com/developerworks/linux/library/l-proc/index.html I know this worked, once upon a time, can't recall if it was 2.4 or 2.6 kernel...
    – Bruce Ediger
    May 9 '12 at 22:39




    IBM Developerworks even has a tutorial on how to do this: ibm.com/developerworks/linux/library/l-proc/index.html I know this worked, once upon a time, can't recall if it was 2.4 or 2.6 kernel...
    – Bruce Ediger
    May 9 '12 at 22:39












    up vote
    5
    down vote













    Ignacio Vazquez-Abrams's answer is correct: files under /proc and /sys are provided by the kernel. If you want to add a file there, write a kernel module. You can find a slightly dated presentation of the /proc programming interface in Linux Device Drivers 3rd ed. ch. 4.



    Technically, it is possible to jump through hoops to make a file appear in /proc/sys/crypto (or anywhere else, really). Make a bind mount from /proc/sys/crypto to a staging directory, and make a union mount of the staging directory and an overlay directory back onto /proc/sys/crypto. Here's an example using unionfs-fuse.



    # mkdir /tmp/original /tmp/overlay
    # mount --bind /proc/sys/crypto /tmp/original
    # unionfs-fuse -o nonempty /tmp/overlay=RW:/tmp/original=RO /proc/sys/crypto
    # echo hello >/proc/sys/crypto/test
    # cat /proc/sys/crypto/test
    hello
    # umount /proc/sys/crypto
    # umount /proc/sys/crypto
    # cat /tmp/overlay/test
    hello


    Note: I disclaim any responsibility for system or brain damage caused by experimenting with this stuff. The commands above are perfectly safe, but messing with other areas of /sys and /proc can cause weird behavior.






    share|improve this answer


























      up vote
      5
      down vote













      Ignacio Vazquez-Abrams's answer is correct: files under /proc and /sys are provided by the kernel. If you want to add a file there, write a kernel module. You can find a slightly dated presentation of the /proc programming interface in Linux Device Drivers 3rd ed. ch. 4.



      Technically, it is possible to jump through hoops to make a file appear in /proc/sys/crypto (or anywhere else, really). Make a bind mount from /proc/sys/crypto to a staging directory, and make a union mount of the staging directory and an overlay directory back onto /proc/sys/crypto. Here's an example using unionfs-fuse.



      # mkdir /tmp/original /tmp/overlay
      # mount --bind /proc/sys/crypto /tmp/original
      # unionfs-fuse -o nonempty /tmp/overlay=RW:/tmp/original=RO /proc/sys/crypto
      # echo hello >/proc/sys/crypto/test
      # cat /proc/sys/crypto/test
      hello
      # umount /proc/sys/crypto
      # umount /proc/sys/crypto
      # cat /tmp/overlay/test
      hello


      Note: I disclaim any responsibility for system or brain damage caused by experimenting with this stuff. The commands above are perfectly safe, but messing with other areas of /sys and /proc can cause weird behavior.






      share|improve this answer
























        up vote
        5
        down vote










        up vote
        5
        down vote









        Ignacio Vazquez-Abrams's answer is correct: files under /proc and /sys are provided by the kernel. If you want to add a file there, write a kernel module. You can find a slightly dated presentation of the /proc programming interface in Linux Device Drivers 3rd ed. ch. 4.



        Technically, it is possible to jump through hoops to make a file appear in /proc/sys/crypto (or anywhere else, really). Make a bind mount from /proc/sys/crypto to a staging directory, and make a union mount of the staging directory and an overlay directory back onto /proc/sys/crypto. Here's an example using unionfs-fuse.



        # mkdir /tmp/original /tmp/overlay
        # mount --bind /proc/sys/crypto /tmp/original
        # unionfs-fuse -o nonempty /tmp/overlay=RW:/tmp/original=RO /proc/sys/crypto
        # echo hello >/proc/sys/crypto/test
        # cat /proc/sys/crypto/test
        hello
        # umount /proc/sys/crypto
        # umount /proc/sys/crypto
        # cat /tmp/overlay/test
        hello


        Note: I disclaim any responsibility for system or brain damage caused by experimenting with this stuff. The commands above are perfectly safe, but messing with other areas of /sys and /proc can cause weird behavior.






        share|improve this answer














        Ignacio Vazquez-Abrams's answer is correct: files under /proc and /sys are provided by the kernel. If you want to add a file there, write a kernel module. You can find a slightly dated presentation of the /proc programming interface in Linux Device Drivers 3rd ed. ch. 4.



        Technically, it is possible to jump through hoops to make a file appear in /proc/sys/crypto (or anywhere else, really). Make a bind mount from /proc/sys/crypto to a staging directory, and make a union mount of the staging directory and an overlay directory back onto /proc/sys/crypto. Here's an example using unionfs-fuse.



        # mkdir /tmp/original /tmp/overlay
        # mount --bind /proc/sys/crypto /tmp/original
        # unionfs-fuse -o nonempty /tmp/overlay=RW:/tmp/original=RO /proc/sys/crypto
        # echo hello >/proc/sys/crypto/test
        # cat /proc/sys/crypto/test
        hello
        # umount /proc/sys/crypto
        # umount /proc/sys/crypto
        # cat /tmp/overlay/test
        hello


        Note: I disclaim any responsibility for system or brain damage caused by experimenting with this stuff. The commands above are perfectly safe, but messing with other areas of /sys and /proc can cause weird behavior.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 13 '17 at 12:36









        Community

        1




        1










        answered May 10 '12 at 1:28









        Gilles

        521k12610401570




        521k12610401570



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f38267%2fis-it-possible-to-create-a-directory-and-file-inside-proc-sys%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

            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?