I am the owner of a file and I have write access: why can't I save?
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.

files osx
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.
|
show 3 more comments
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.

files osx
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.confwhile 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.confinstead of~/data/pg_hba.conf? 4) post the output ofls -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 usingsudo?
– 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
|
show 3 more comments
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.

files osx
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.

files osx
files osx
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.confwhile 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.confinstead of~/data/pg_hba.conf? 4) post the output ofls -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 usingsudo?
– 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
|
show 3 more comments
1
The error from Sublime shows the file at~/data/pg_hba.confwhile 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.confinstead of~/data/pg_hba.conf? 4) post the output ofls -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 usingsudo?
– 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
|
show 3 more comments
1 Answer
1
active
oldest
votes
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
answered Mar 23 '14 at 20:42
bernie2436bernie2436
2,083154057
2,083154057
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
The error from Sublime shows the file at
~/data/pg_hba.confwhile 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.confinstead of~/data/pg_hba.conf? 4) post the output ofls -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 usingsudo?– 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