Why root Can't open file for writing?

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











up vote
2
down vote

favorite












[root@localhost ~]# vim /usr/lib64/sas12/smtpd.conf 
pwcheck_method: saslauthd
mech_list: PLAIN LOGIN
log_level:3


:wq



An error occurs.



"/usr/lib64/sas12/smtpd.conf" E212: Can't open file for writing. 


Why root can't open file for writing?



enter image description here







share|improve this question
























    up vote
    2
    down vote

    favorite












    [root@localhost ~]# vim /usr/lib64/sas12/smtpd.conf 
    pwcheck_method: saslauthd
    mech_list: PLAIN LOGIN
    log_level:3


    :wq



    An error occurs.



    "/usr/lib64/sas12/smtpd.conf" E212: Can't open file for writing. 


    Why root can't open file for writing?



    enter image description here







    share|improve this question






















      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      [root@localhost ~]# vim /usr/lib64/sas12/smtpd.conf 
      pwcheck_method: saslauthd
      mech_list: PLAIN LOGIN
      log_level:3


      :wq



      An error occurs.



      "/usr/lib64/sas12/smtpd.conf" E212: Can't open file for writing. 


      Why root can't open file for writing?



      enter image description here







      share|improve this question












      [root@localhost ~]# vim /usr/lib64/sas12/smtpd.conf 
      pwcheck_method: saslauthd
      mech_list: PLAIN LOGIN
      log_level:3


      :wq



      An error occurs.



      "/usr/lib64/sas12/smtpd.conf" E212: Can't open file for writing. 


      Why root can't open file for writing?



      enter image description here









      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 29 '17 at 11:56









      it_is_a_literature

      21232350




      21232350




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          Check that the /usr/lib64/sas12 directory already exists:



          root@host:~# ls /usr/lib64/sas12


          If it is not the case, you must create the directory before attempting to create the file:



          root@host:~# mkdir -p /usr/lib64/sas12
          root@host:~# vim /usr/lib64/sas12/smtpd.conf


          You vim command should now work as expected.






          share|improve this answer



























            up vote
            0
            down vote













            Either the filesystem is mounted read-only or this is not a root permission problem but a vim feature. Use a different editor or change the file permissions (e.g. make root the file owner), edit the file, and change them back.






            share|improve this answer



























              up vote
              0
              down vote













              This can happen if there is a swap file as well at the same location which might set a lock on the file for editing.



              example please look for the file



              /usr/lib64/sas12/.smtpd.conf.swp



              If this file exists, then you can't edit the file. Try removing it and then editing it should work.






              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%2f401203%2fwhy-root-cant-open-file-for-writing%23new-answer', 'question_page');

                );

                Post as a guest






























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                1
                down vote



                accepted










                Check that the /usr/lib64/sas12 directory already exists:



                root@host:~# ls /usr/lib64/sas12


                If it is not the case, you must create the directory before attempting to create the file:



                root@host:~# mkdir -p /usr/lib64/sas12
                root@host:~# vim /usr/lib64/sas12/smtpd.conf


                You vim command should now work as expected.






                share|improve this answer
























                  up vote
                  1
                  down vote



                  accepted










                  Check that the /usr/lib64/sas12 directory already exists:



                  root@host:~# ls /usr/lib64/sas12


                  If it is not the case, you must create the directory before attempting to create the file:



                  root@host:~# mkdir -p /usr/lib64/sas12
                  root@host:~# vim /usr/lib64/sas12/smtpd.conf


                  You vim command should now work as expected.






                  share|improve this answer






















                    up vote
                    1
                    down vote



                    accepted







                    up vote
                    1
                    down vote



                    accepted






                    Check that the /usr/lib64/sas12 directory already exists:



                    root@host:~# ls /usr/lib64/sas12


                    If it is not the case, you must create the directory before attempting to create the file:



                    root@host:~# mkdir -p /usr/lib64/sas12
                    root@host:~# vim /usr/lib64/sas12/smtpd.conf


                    You vim command should now work as expected.






                    share|improve this answer












                    Check that the /usr/lib64/sas12 directory already exists:



                    root@host:~# ls /usr/lib64/sas12


                    If it is not the case, you must create the directory before attempting to create the file:



                    root@host:~# mkdir -p /usr/lib64/sas12
                    root@host:~# vim /usr/lib64/sas12/smtpd.conf


                    You vim command should now work as expected.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Oct 29 '17 at 12:38









                    WhiteWinterWolf

                    1,586830




                    1,586830






















                        up vote
                        0
                        down vote













                        Either the filesystem is mounted read-only or this is not a root permission problem but a vim feature. Use a different editor or change the file permissions (e.g. make root the file owner), edit the file, and change them back.






                        share|improve this answer
























                          up vote
                          0
                          down vote













                          Either the filesystem is mounted read-only or this is not a root permission problem but a vim feature. Use a different editor or change the file permissions (e.g. make root the file owner), edit the file, and change them back.






                          share|improve this answer






















                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            Either the filesystem is mounted read-only or this is not a root permission problem but a vim feature. Use a different editor or change the file permissions (e.g. make root the file owner), edit the file, and change them back.






                            share|improve this answer












                            Either the filesystem is mounted read-only or this is not a root permission problem but a vim feature. Use a different editor or change the file permissions (e.g. make root the file owner), edit the file, and change them back.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Oct 29 '17 at 12:09









                            Hauke Laging

                            53.6k1282130




                            53.6k1282130




















                                up vote
                                0
                                down vote













                                This can happen if there is a swap file as well at the same location which might set a lock on the file for editing.



                                example please look for the file



                                /usr/lib64/sas12/.smtpd.conf.swp



                                If this file exists, then you can't edit the file. Try removing it and then editing it should work.






                                share|improve this answer


























                                  up vote
                                  0
                                  down vote













                                  This can happen if there is a swap file as well at the same location which might set a lock on the file for editing.



                                  example please look for the file



                                  /usr/lib64/sas12/.smtpd.conf.swp



                                  If this file exists, then you can't edit the file. Try removing it and then editing it should work.






                                  share|improve this answer
























                                    up vote
                                    0
                                    down vote










                                    up vote
                                    0
                                    down vote









                                    This can happen if there is a swap file as well at the same location which might set a lock on the file for editing.



                                    example please look for the file



                                    /usr/lib64/sas12/.smtpd.conf.swp



                                    If this file exists, then you can't edit the file. Try removing it and then editing it should work.






                                    share|improve this answer














                                    This can happen if there is a swap file as well at the same location which might set a lock on the file for editing.



                                    example please look for the file



                                    /usr/lib64/sas12/.smtpd.conf.swp



                                    If this file exists, then you can't edit the file. Try removing it and then editing it should work.







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Jul 2 at 10:50









                                    Kevin Lemaire

                                    1,046421




                                    1,046421










                                    answered Jul 2 at 9:06









                                    satish arya

                                    11




                                    11



























                                         

                                        draft saved


                                        draft discarded















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401203%2fwhy-root-cant-open-file-for-writing%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