I am the owner of a file and I have write access: why can't I save?












0















I am on OSX 10.9.2



I am locked out of postgres and trying to modify pg_hba.conf to get back in. https://stackoverflow.com/questions/11919275/can-not-enter-and-change-postgresql-pg-hba-conf-file



I run these commands:



$sudo ls -l /Library/PostgreSQL/9.3/data/pg_hba.conf
-rwx--x--x 1 abramhandler daemon 4222 Oct 9 20:42 /Library/PostgreSQL/9.3/data/pg_hba.conf
$ whoami
abramhandler
$ sudo subl /Library/PostgreSQL/9.3/data/pg_hba.conf


I make changes and click save and get an error from sublime text 2: Unable to save ~/data/pg_hba.conf



The ls -l command shows that I own the file and have write access. Why can't I save?



Note: I think I am saving to /Library/PostgreSQL/9.3/data/pg_hba.conf even if I get that error message. Data has a little red circle on it -- which probably indicates a problem.



enter image description here










share|improve this question
















bumped to the homepage by Community 5 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1





    The error from Sublime shows the file at ~/data/pg_hba.conf while in your terminal it looks like the file is at /Library/PostgreSQL/9.3/data/pg_hba.conf. Are you using /Library/PostgreSQL/9.3/ as your home directory? Or do you have one file open in Sublime Text, when you're looking at a completely different file in the terminal?

    – Sajan Parikh
    Mar 17 '14 at 3:52








  • 1





    Please edit your question and 1) tell us what user you are running sublime as 2) what is that user's home directory (echo ~)? 3) Have you tried saving to /Library/PostgreSQL/9.3/data/pg_hba.conf instead of ~/data/pg_hba.conf? 4) post the output of ls -l ~/data/pg_hba.conf

    – terdon
    Mar 17 '14 at 4:03






  • 1





    he's running Sublime as root, due to the sudo. try changing the owner of the file to root and try again. I think it's denied because root doesn't have access to the file (yes, this is possible - the distinction is that root has the power to get access, whereas normal users don't).

    – strugee
    Mar 17 '14 at 4:10






  • 1





    Does it work if you try writing to that file from another process, e.g. echo | sudo tee -a /Library/PostgreSQL/9.3/data/pg_hba.conf (don't forget the -a!)? Why are you using sudo?

    – Gilles
    Mar 17 '14 at 20:12






  • 1





    If you need to do an ls to see the file, then you don't have access to the directory to save it. Confirm that subl is really, really running Sublime Text as root (check Activity Monitor or ps). I suspect it is running it as your user, and the user does not have access to one of the directories in the path.

    – Alan Shutko
    Mar 17 '14 at 21:18
















0















I am on OSX 10.9.2



I am locked out of postgres and trying to modify pg_hba.conf to get back in. https://stackoverflow.com/questions/11919275/can-not-enter-and-change-postgresql-pg-hba-conf-file



I run these commands:



$sudo ls -l /Library/PostgreSQL/9.3/data/pg_hba.conf
-rwx--x--x 1 abramhandler daemon 4222 Oct 9 20:42 /Library/PostgreSQL/9.3/data/pg_hba.conf
$ whoami
abramhandler
$ sudo subl /Library/PostgreSQL/9.3/data/pg_hba.conf


I make changes and click save and get an error from sublime text 2: Unable to save ~/data/pg_hba.conf



The ls -l command shows that I own the file and have write access. Why can't I save?



Note: I think I am saving to /Library/PostgreSQL/9.3/data/pg_hba.conf even if I get that error message. Data has a little red circle on it -- which probably indicates a problem.



enter image description here










share|improve this question
















bumped to the homepage by Community 5 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1





    The error from Sublime shows the file at ~/data/pg_hba.conf while in your terminal it looks like the file is at /Library/PostgreSQL/9.3/data/pg_hba.conf. Are you using /Library/PostgreSQL/9.3/ as your home directory? Or do you have one file open in Sublime Text, when you're looking at a completely different file in the terminal?

    – Sajan Parikh
    Mar 17 '14 at 3:52








  • 1





    Please edit your question and 1) tell us what user you are running sublime as 2) what is that user's home directory (echo ~)? 3) Have you tried saving to /Library/PostgreSQL/9.3/data/pg_hba.conf instead of ~/data/pg_hba.conf? 4) post the output of ls -l ~/data/pg_hba.conf

    – terdon
    Mar 17 '14 at 4:03






  • 1





    he's running Sublime as root, due to the sudo. try changing the owner of the file to root and try again. I think it's denied because root doesn't have access to the file (yes, this is possible - the distinction is that root has the power to get access, whereas normal users don't).

    – strugee
    Mar 17 '14 at 4:10






  • 1





    Does it work if you try writing to that file from another process, e.g. echo | sudo tee -a /Library/PostgreSQL/9.3/data/pg_hba.conf (don't forget the -a!)? Why are you using sudo?

    – Gilles
    Mar 17 '14 at 20:12






  • 1





    If you need to do an ls to see the file, then you don't have access to the directory to save it. Confirm that subl is really, really running Sublime Text as root (check Activity Monitor or ps). I suspect it is running it as your user, and the user does not have access to one of the directories in the path.

    – Alan Shutko
    Mar 17 '14 at 21:18














0












0








0








I am on OSX 10.9.2



I am locked out of postgres and trying to modify pg_hba.conf to get back in. https://stackoverflow.com/questions/11919275/can-not-enter-and-change-postgresql-pg-hba-conf-file



I run these commands:



$sudo ls -l /Library/PostgreSQL/9.3/data/pg_hba.conf
-rwx--x--x 1 abramhandler daemon 4222 Oct 9 20:42 /Library/PostgreSQL/9.3/data/pg_hba.conf
$ whoami
abramhandler
$ sudo subl /Library/PostgreSQL/9.3/data/pg_hba.conf


I make changes and click save and get an error from sublime text 2: Unable to save ~/data/pg_hba.conf



The ls -l command shows that I own the file and have write access. Why can't I save?



Note: I think I am saving to /Library/PostgreSQL/9.3/data/pg_hba.conf even if I get that error message. Data has a little red circle on it -- which probably indicates a problem.



enter image description here










share|improve this question
















I am on OSX 10.9.2



I am locked out of postgres and trying to modify pg_hba.conf to get back in. https://stackoverflow.com/questions/11919275/can-not-enter-and-change-postgresql-pg-hba-conf-file



I run these commands:



$sudo ls -l /Library/PostgreSQL/9.3/data/pg_hba.conf
-rwx--x--x 1 abramhandler daemon 4222 Oct 9 20:42 /Library/PostgreSQL/9.3/data/pg_hba.conf
$ whoami
abramhandler
$ sudo subl /Library/PostgreSQL/9.3/data/pg_hba.conf


I make changes and click save and get an error from sublime text 2: Unable to save ~/data/pg_hba.conf



The ls -l command shows that I own the file and have write access. Why can't I save?



Note: I think I am saving to /Library/PostgreSQL/9.3/data/pg_hba.conf even if I get that error message. Data has a little red circle on it -- which probably indicates a problem.



enter image description here







files osx






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 23 '17 at 12:39









Community

1




1










asked Mar 17 '14 at 3:44









bernie2436bernie2436

2,083154057




2,083154057





bumped to the homepage by Community 5 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 5 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 1





    The error from Sublime shows the file at ~/data/pg_hba.conf while in your terminal it looks like the file is at /Library/PostgreSQL/9.3/data/pg_hba.conf. Are you using /Library/PostgreSQL/9.3/ as your home directory? Or do you have one file open in Sublime Text, when you're looking at a completely different file in the terminal?

    – Sajan Parikh
    Mar 17 '14 at 3:52








  • 1





    Please edit your question and 1) tell us what user you are running sublime as 2) what is that user's home directory (echo ~)? 3) Have you tried saving to /Library/PostgreSQL/9.3/data/pg_hba.conf instead of ~/data/pg_hba.conf? 4) post the output of ls -l ~/data/pg_hba.conf

    – terdon
    Mar 17 '14 at 4:03






  • 1





    he's running Sublime as root, due to the sudo. try changing the owner of the file to root and try again. I think it's denied because root doesn't have access to the file (yes, this is possible - the distinction is that root has the power to get access, whereas normal users don't).

    – strugee
    Mar 17 '14 at 4:10






  • 1





    Does it work if you try writing to that file from another process, e.g. echo | sudo tee -a /Library/PostgreSQL/9.3/data/pg_hba.conf (don't forget the -a!)? Why are you using sudo?

    – Gilles
    Mar 17 '14 at 20:12






  • 1





    If you need to do an ls to see the file, then you don't have access to the directory to save it. Confirm that subl is really, really running Sublime Text as root (check Activity Monitor or ps). I suspect it is running it as your user, and the user does not have access to one of the directories in the path.

    – Alan Shutko
    Mar 17 '14 at 21:18














  • 1





    The error from Sublime shows the file at ~/data/pg_hba.conf while in your terminal it looks like the file is at /Library/PostgreSQL/9.3/data/pg_hba.conf. Are you using /Library/PostgreSQL/9.3/ as your home directory? Or do you have one file open in Sublime Text, when you're looking at a completely different file in the terminal?

    – Sajan Parikh
    Mar 17 '14 at 3:52








  • 1





    Please edit your question and 1) tell us what user you are running sublime as 2) what is that user's home directory (echo ~)? 3) Have you tried saving to /Library/PostgreSQL/9.3/data/pg_hba.conf instead of ~/data/pg_hba.conf? 4) post the output of ls -l ~/data/pg_hba.conf

    – terdon
    Mar 17 '14 at 4:03






  • 1





    he's running Sublime as root, due to the sudo. try changing the owner of the file to root and try again. I think it's denied because root doesn't have access to the file (yes, this is possible - the distinction is that root has the power to get access, whereas normal users don't).

    – strugee
    Mar 17 '14 at 4:10






  • 1





    Does it work if you try writing to that file from another process, e.g. echo | sudo tee -a /Library/PostgreSQL/9.3/data/pg_hba.conf (don't forget the -a!)? Why are you using sudo?

    – Gilles
    Mar 17 '14 at 20:12






  • 1





    If you need to do an ls to see the file, then you don't have access to the directory to save it. Confirm that subl is really, really running Sublime Text as root (check Activity Monitor or ps). I suspect it is running it as your user, and the user does not have access to one of the directories in the path.

    – Alan Shutko
    Mar 17 '14 at 21:18








1




1





The error from Sublime shows the file at ~/data/pg_hba.conf while in your terminal it looks like the file is at /Library/PostgreSQL/9.3/data/pg_hba.conf. Are you using /Library/PostgreSQL/9.3/ as your home directory? Or do you have one file open in Sublime Text, when you're looking at a completely different file in the terminal?

– Sajan Parikh
Mar 17 '14 at 3:52







The error from Sublime shows the file at ~/data/pg_hba.conf while in your terminal it looks like the file is at /Library/PostgreSQL/9.3/data/pg_hba.conf. Are you using /Library/PostgreSQL/9.3/ as your home directory? Or do you have one file open in Sublime Text, when you're looking at a completely different file in the terminal?

– Sajan Parikh
Mar 17 '14 at 3:52






1




1





Please edit your question and 1) tell us what user you are running sublime as 2) what is that user's home directory (echo ~)? 3) Have you tried saving to /Library/PostgreSQL/9.3/data/pg_hba.conf instead of ~/data/pg_hba.conf? 4) post the output of ls -l ~/data/pg_hba.conf

– terdon
Mar 17 '14 at 4:03





Please edit your question and 1) tell us what user you are running sublime as 2) what is that user's home directory (echo ~)? 3) Have you tried saving to /Library/PostgreSQL/9.3/data/pg_hba.conf instead of ~/data/pg_hba.conf? 4) post the output of ls -l ~/data/pg_hba.conf

– terdon
Mar 17 '14 at 4:03




1




1





he's running Sublime as root, due to the sudo. try changing the owner of the file to root and try again. I think it's denied because root doesn't have access to the file (yes, this is possible - the distinction is that root has the power to get access, whereas normal users don't).

– strugee
Mar 17 '14 at 4:10





he's running Sublime as root, due to the sudo. try changing the owner of the file to root and try again. I think it's denied because root doesn't have access to the file (yes, this is possible - the distinction is that root has the power to get access, whereas normal users don't).

– strugee
Mar 17 '14 at 4:10




1




1





Does it work if you try writing to that file from another process, e.g. echo | sudo tee -a /Library/PostgreSQL/9.3/data/pg_hba.conf (don't forget the -a!)? Why are you using sudo?

– Gilles
Mar 17 '14 at 20:12





Does it work if you try writing to that file from another process, e.g. echo | sudo tee -a /Library/PostgreSQL/9.3/data/pg_hba.conf (don't forget the -a!)? Why are you using sudo?

– Gilles
Mar 17 '14 at 20:12




1




1





If you need to do an ls to see the file, then you don't have access to the directory to save it. Confirm that subl is really, really running Sublime Text as root (check Activity Monitor or ps). I suspect it is running it as your user, and the user does not have access to one of the directories in the path.

– Alan Shutko
Mar 17 '14 at 21:18





If you need to do an ls to see the file, then you don't have access to the directory to save it. Confirm that subl is really, really running Sublime Text as root (check Activity Monitor or ps). I suspect it is running it as your user, and the user does not have access to one of the directories in the path.

– Alan Shutko
Mar 17 '14 at 21:18










1 Answer
1






active

oldest

votes


















0














I needed to chown the containing folder -- not just the file itself. Once I chowned the containing folder I was able to save.



$pwd 
Library/PostgreSQL/9.3/
$sudo chown abramhandler data





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',
    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%2f120027%2fi-am-the-owner-of-a-file-and-i-have-write-access-why-cant-i-save%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









    0














    I needed to chown the containing folder -- not just the file itself. Once I chowned the containing folder I was able to save.



    $pwd 
    Library/PostgreSQL/9.3/
    $sudo chown abramhandler data





    share|improve this answer




























      0














      I needed to chown the containing folder -- not just the file itself. Once I chowned the containing folder I was able to save.



      $pwd 
      Library/PostgreSQL/9.3/
      $sudo chown abramhandler data





      share|improve this answer


























        0












        0








        0







        I needed to chown the containing folder -- not just the file itself. Once I chowned the containing folder I was able to save.



        $pwd 
        Library/PostgreSQL/9.3/
        $sudo chown abramhandler data





        share|improve this answer













        I needed to chown the containing folder -- not just the file itself. Once I chowned the containing folder I was able to save.



        $pwd 
        Library/PostgreSQL/9.3/
        $sudo chown abramhandler data






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 23 '14 at 20:42









        bernie2436bernie2436

        2,083154057




        2,083154057






























            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%2f120027%2fi-am-the-owner-of-a-file-and-i-have-write-access-why-cant-i-save%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

            Histoire des bourses de valeurs

            Why is there Russian traffic in my log files?

            Rename multiple files to decrement number in file name?