ls: cannot access .gvfs: Permission denied












9















Whenever I run an application in terminal as root (such as sudo gedit /etc/default/varnish) , subsequently when I open another terminal I get "ls: cannot access .gvfs: Permission denied" error at top line of terminal.



I found a solution on the net



  umount /path/to/.gvfs
rm -rf .gvfs


but it only fixes problem temporarily.



It appears that I have two mounted instances of gvfs in my system



  $ sudo mount |grep gvfs
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=33)
gvfsd-fuse on /home/****/.gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)


I don't know if it's related to, a few months ago I had to change permission in my home folder like



  sudo chown -R $USER:www-data


Would you please help me fix it?



EDIT:
After I unmount /run/user/1000/gvfs I don't get that error.










share|improve this question




















  • 1





    And that's one of the reasons why you shouldn't run sudo with graphical programs.

    – muru
    Sep 16 '14 at 11:24








  • 1





    possible duplicate of Why user should never use normal sudo to start graphical application?

    – muru
    Sep 16 '14 at 13:00











  • @muru Thank you for the link, it explains well why I should not run sudo to open graphical applications. But I still wonder why I began to get that error message

    – kenn
    Sep 16 '14 at 14:13











  • Quoting the top answer in the linked question: "This will sometimes result in the configuration files being owned by root and thus inaccessible to you (when you later run the program as yourself and not as root)."

    – muru
    Sep 16 '14 at 14:17






  • 1





    I suspect this particular situation may actually not be related to running graphical programs with straight sudo. Permissions/access on users .gvfs folders have always been interesting and (to some of us) surprising.

    – Eliah Kagan
    Sep 16 '14 at 19:28


















9















Whenever I run an application in terminal as root (such as sudo gedit /etc/default/varnish) , subsequently when I open another terminal I get "ls: cannot access .gvfs: Permission denied" error at top line of terminal.



I found a solution on the net



  umount /path/to/.gvfs
rm -rf .gvfs


but it only fixes problem temporarily.



It appears that I have two mounted instances of gvfs in my system



  $ sudo mount |grep gvfs
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=33)
gvfsd-fuse on /home/****/.gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)


I don't know if it's related to, a few months ago I had to change permission in my home folder like



  sudo chown -R $USER:www-data


Would you please help me fix it?



EDIT:
After I unmount /run/user/1000/gvfs I don't get that error.










share|improve this question




















  • 1





    And that's one of the reasons why you shouldn't run sudo with graphical programs.

    – muru
    Sep 16 '14 at 11:24








  • 1





    possible duplicate of Why user should never use normal sudo to start graphical application?

    – muru
    Sep 16 '14 at 13:00











  • @muru Thank you for the link, it explains well why I should not run sudo to open graphical applications. But I still wonder why I began to get that error message

    – kenn
    Sep 16 '14 at 14:13











  • Quoting the top answer in the linked question: "This will sometimes result in the configuration files being owned by root and thus inaccessible to you (when you later run the program as yourself and not as root)."

    – muru
    Sep 16 '14 at 14:17






  • 1





    I suspect this particular situation may actually not be related to running graphical programs with straight sudo. Permissions/access on users .gvfs folders have always been interesting and (to some of us) surprising.

    – Eliah Kagan
    Sep 16 '14 at 19:28
















9












9








9


1






Whenever I run an application in terminal as root (such as sudo gedit /etc/default/varnish) , subsequently when I open another terminal I get "ls: cannot access .gvfs: Permission denied" error at top line of terminal.



I found a solution on the net



  umount /path/to/.gvfs
rm -rf .gvfs


but it only fixes problem temporarily.



It appears that I have two mounted instances of gvfs in my system



  $ sudo mount |grep gvfs
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=33)
gvfsd-fuse on /home/****/.gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)


I don't know if it's related to, a few months ago I had to change permission in my home folder like



  sudo chown -R $USER:www-data


Would you please help me fix it?



EDIT:
After I unmount /run/user/1000/gvfs I don't get that error.










share|improve this question
















Whenever I run an application in terminal as root (such as sudo gedit /etc/default/varnish) , subsequently when I open another terminal I get "ls: cannot access .gvfs: Permission denied" error at top line of terminal.



I found a solution on the net



  umount /path/to/.gvfs
rm -rf .gvfs


but it only fixes problem temporarily.



It appears that I have two mounted instances of gvfs in my system



  $ sudo mount |grep gvfs
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=33)
gvfsd-fuse on /home/****/.gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=0,group_id=0)


I don't know if it's related to, a few months ago I had to change permission in my home folder like



  sudo chown -R $USER:www-data


Would you please help me fix it?



EDIT:
After I unmount /run/user/1000/gvfs I don't get that error.







gnome-terminal gvfs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 16 '14 at 14:17







kenn

















asked Sep 16 '14 at 11:23









kennkenn

2,84353065




2,84353065








  • 1





    And that's one of the reasons why you shouldn't run sudo with graphical programs.

    – muru
    Sep 16 '14 at 11:24








  • 1





    possible duplicate of Why user should never use normal sudo to start graphical application?

    – muru
    Sep 16 '14 at 13:00











  • @muru Thank you for the link, it explains well why I should not run sudo to open graphical applications. But I still wonder why I began to get that error message

    – kenn
    Sep 16 '14 at 14:13











  • Quoting the top answer in the linked question: "This will sometimes result in the configuration files being owned by root and thus inaccessible to you (when you later run the program as yourself and not as root)."

    – muru
    Sep 16 '14 at 14:17






  • 1





    I suspect this particular situation may actually not be related to running graphical programs with straight sudo. Permissions/access on users .gvfs folders have always been interesting and (to some of us) surprising.

    – Eliah Kagan
    Sep 16 '14 at 19:28
















  • 1





    And that's one of the reasons why you shouldn't run sudo with graphical programs.

    – muru
    Sep 16 '14 at 11:24








  • 1





    possible duplicate of Why user should never use normal sudo to start graphical application?

    – muru
    Sep 16 '14 at 13:00











  • @muru Thank you for the link, it explains well why I should not run sudo to open graphical applications. But I still wonder why I began to get that error message

    – kenn
    Sep 16 '14 at 14:13











  • Quoting the top answer in the linked question: "This will sometimes result in the configuration files being owned by root and thus inaccessible to you (when you later run the program as yourself and not as root)."

    – muru
    Sep 16 '14 at 14:17






  • 1





    I suspect this particular situation may actually not be related to running graphical programs with straight sudo. Permissions/access on users .gvfs folders have always been interesting and (to some of us) surprising.

    – Eliah Kagan
    Sep 16 '14 at 19:28










1




1





And that's one of the reasons why you shouldn't run sudo with graphical programs.

– muru
Sep 16 '14 at 11:24







And that's one of the reasons why you shouldn't run sudo with graphical programs.

– muru
Sep 16 '14 at 11:24






1




1





possible duplicate of Why user should never use normal sudo to start graphical application?

– muru
Sep 16 '14 at 13:00





possible duplicate of Why user should never use normal sudo to start graphical application?

– muru
Sep 16 '14 at 13:00













@muru Thank you for the link, it explains well why I should not run sudo to open graphical applications. But I still wonder why I began to get that error message

– kenn
Sep 16 '14 at 14:13





@muru Thank you for the link, it explains well why I should not run sudo to open graphical applications. But I still wonder why I began to get that error message

– kenn
Sep 16 '14 at 14:13













Quoting the top answer in the linked question: "This will sometimes result in the configuration files being owned by root and thus inaccessible to you (when you later run the program as yourself and not as root)."

– muru
Sep 16 '14 at 14:17





Quoting the top answer in the linked question: "This will sometimes result in the configuration files being owned by root and thus inaccessible to you (when you later run the program as yourself and not as root)."

– muru
Sep 16 '14 at 14:17




1




1





I suspect this particular situation may actually not be related to running graphical programs with straight sudo. Permissions/access on users .gvfs folders have always been interesting and (to some of us) surprising.

– Eliah Kagan
Sep 16 '14 at 19:28







I suspect this particular situation may actually not be related to running graphical programs with straight sudo. Permissions/access on users .gvfs folders have always been interesting and (to some of us) surprising.

– Eliah Kagan
Sep 16 '14 at 19:28












1 Answer
1






active

oldest

votes


















7














Running graphical applications with sudo can sometimes lead to problems like this.



Explanation



sudo runs the program with superuser privileges (like running as root), but the program still sees the current home directory as your home directory.



So, when the software writes its configuration files, it'll end up creating files in your home directory that are owned by the root user. You end up with files you yourself cannot edit or delete, and software running as you won't be able to modify it either, leading to more problems.



What is the best solution?



There is an alternative: gksudo.



This variant of sudo will set up environment variables, such as the home directory, in such a way that makes running graphical applications as root a lot safer and won't confuse programs into creating root-owned files in your home directory.



Why does this affect graphical applications?



This doesn't just affect graphical applications, nor does it affect all graphical applications. It affects applications that store configuration inside the current user's home directory. This is just more common among graphical applications.



Sometimes applications will be able to detect if they're run with sudo and adjust their behaviour accordingly, but this is not common with graphical applications which are usually not expected to be run with sudo.



How do I fix the problem?



You'll need to find root-owned files and directories within your home directory and remove them. It's better to remove them than change their ownership in my opinion, as they were not intended for your user, but the root user, so there may be unexpected effects if you simply change ownership. You can of course back them up in case you decide there's something you want in them later.



To find root-owned files in your home directory:



find ~ -user root


If you are still having problems with some applications (run as your user), try rebooting to clear out /tmp and anything still running. Occasionally some applications might have corrupted their existing config files and need you to remove all their configuration in your home directory, but hopefully this won't be the case for many.






share|improve this answer


























  • Thank you for explanation. How can I fix it? Or everybody has the same issue as me?

    – kenn
    Sep 16 '14 at 11:43






  • 3





    By using gksudo instead of sudo when running graphical programs.

    – thomasrutter
    Sep 16 '14 at 11:44











  • So there is nothing wrong in my system.

    – kenn
    Sep 16 '14 at 11:54






  • 2





    Yes, other than the possibility you now have root-owned files in your home directory that shouldn't be root-owned.

    – thomasrutter
    Sep 19 '14 at 0:23












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2faskubuntu.com%2fquestions%2f524667%2fls-cannot-access-gvfs-permission-denied%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









7














Running graphical applications with sudo can sometimes lead to problems like this.



Explanation



sudo runs the program with superuser privileges (like running as root), but the program still sees the current home directory as your home directory.



So, when the software writes its configuration files, it'll end up creating files in your home directory that are owned by the root user. You end up with files you yourself cannot edit or delete, and software running as you won't be able to modify it either, leading to more problems.



What is the best solution?



There is an alternative: gksudo.



This variant of sudo will set up environment variables, such as the home directory, in such a way that makes running graphical applications as root a lot safer and won't confuse programs into creating root-owned files in your home directory.



Why does this affect graphical applications?



This doesn't just affect graphical applications, nor does it affect all graphical applications. It affects applications that store configuration inside the current user's home directory. This is just more common among graphical applications.



Sometimes applications will be able to detect if they're run with sudo and adjust their behaviour accordingly, but this is not common with graphical applications which are usually not expected to be run with sudo.



How do I fix the problem?



You'll need to find root-owned files and directories within your home directory and remove them. It's better to remove them than change their ownership in my opinion, as they were not intended for your user, but the root user, so there may be unexpected effects if you simply change ownership. You can of course back them up in case you decide there's something you want in them later.



To find root-owned files in your home directory:



find ~ -user root


If you are still having problems with some applications (run as your user), try rebooting to clear out /tmp and anything still running. Occasionally some applications might have corrupted their existing config files and need you to remove all their configuration in your home directory, but hopefully this won't be the case for many.






share|improve this answer


























  • Thank you for explanation. How can I fix it? Or everybody has the same issue as me?

    – kenn
    Sep 16 '14 at 11:43






  • 3





    By using gksudo instead of sudo when running graphical programs.

    – thomasrutter
    Sep 16 '14 at 11:44











  • So there is nothing wrong in my system.

    – kenn
    Sep 16 '14 at 11:54






  • 2





    Yes, other than the possibility you now have root-owned files in your home directory that shouldn't be root-owned.

    – thomasrutter
    Sep 19 '14 at 0:23
















7














Running graphical applications with sudo can sometimes lead to problems like this.



Explanation



sudo runs the program with superuser privileges (like running as root), but the program still sees the current home directory as your home directory.



So, when the software writes its configuration files, it'll end up creating files in your home directory that are owned by the root user. You end up with files you yourself cannot edit or delete, and software running as you won't be able to modify it either, leading to more problems.



What is the best solution?



There is an alternative: gksudo.



This variant of sudo will set up environment variables, such as the home directory, in such a way that makes running graphical applications as root a lot safer and won't confuse programs into creating root-owned files in your home directory.



Why does this affect graphical applications?



This doesn't just affect graphical applications, nor does it affect all graphical applications. It affects applications that store configuration inside the current user's home directory. This is just more common among graphical applications.



Sometimes applications will be able to detect if they're run with sudo and adjust their behaviour accordingly, but this is not common with graphical applications which are usually not expected to be run with sudo.



How do I fix the problem?



You'll need to find root-owned files and directories within your home directory and remove them. It's better to remove them than change their ownership in my opinion, as they were not intended for your user, but the root user, so there may be unexpected effects if you simply change ownership. You can of course back them up in case you decide there's something you want in them later.



To find root-owned files in your home directory:



find ~ -user root


If you are still having problems with some applications (run as your user), try rebooting to clear out /tmp and anything still running. Occasionally some applications might have corrupted their existing config files and need you to remove all their configuration in your home directory, but hopefully this won't be the case for many.






share|improve this answer


























  • Thank you for explanation. How can I fix it? Or everybody has the same issue as me?

    – kenn
    Sep 16 '14 at 11:43






  • 3





    By using gksudo instead of sudo when running graphical programs.

    – thomasrutter
    Sep 16 '14 at 11:44











  • So there is nothing wrong in my system.

    – kenn
    Sep 16 '14 at 11:54






  • 2





    Yes, other than the possibility you now have root-owned files in your home directory that shouldn't be root-owned.

    – thomasrutter
    Sep 19 '14 at 0:23














7












7








7







Running graphical applications with sudo can sometimes lead to problems like this.



Explanation



sudo runs the program with superuser privileges (like running as root), but the program still sees the current home directory as your home directory.



So, when the software writes its configuration files, it'll end up creating files in your home directory that are owned by the root user. You end up with files you yourself cannot edit or delete, and software running as you won't be able to modify it either, leading to more problems.



What is the best solution?



There is an alternative: gksudo.



This variant of sudo will set up environment variables, such as the home directory, in such a way that makes running graphical applications as root a lot safer and won't confuse programs into creating root-owned files in your home directory.



Why does this affect graphical applications?



This doesn't just affect graphical applications, nor does it affect all graphical applications. It affects applications that store configuration inside the current user's home directory. This is just more common among graphical applications.



Sometimes applications will be able to detect if they're run with sudo and adjust their behaviour accordingly, but this is not common with graphical applications which are usually not expected to be run with sudo.



How do I fix the problem?



You'll need to find root-owned files and directories within your home directory and remove them. It's better to remove them than change their ownership in my opinion, as they were not intended for your user, but the root user, so there may be unexpected effects if you simply change ownership. You can of course back them up in case you decide there's something you want in them later.



To find root-owned files in your home directory:



find ~ -user root


If you are still having problems with some applications (run as your user), try rebooting to clear out /tmp and anything still running. Occasionally some applications might have corrupted their existing config files and need you to remove all their configuration in your home directory, but hopefully this won't be the case for many.






share|improve this answer















Running graphical applications with sudo can sometimes lead to problems like this.



Explanation



sudo runs the program with superuser privileges (like running as root), but the program still sees the current home directory as your home directory.



So, when the software writes its configuration files, it'll end up creating files in your home directory that are owned by the root user. You end up with files you yourself cannot edit or delete, and software running as you won't be able to modify it either, leading to more problems.



What is the best solution?



There is an alternative: gksudo.



This variant of sudo will set up environment variables, such as the home directory, in such a way that makes running graphical applications as root a lot safer and won't confuse programs into creating root-owned files in your home directory.



Why does this affect graphical applications?



This doesn't just affect graphical applications, nor does it affect all graphical applications. It affects applications that store configuration inside the current user's home directory. This is just more common among graphical applications.



Sometimes applications will be able to detect if they're run with sudo and adjust their behaviour accordingly, but this is not common with graphical applications which are usually not expected to be run with sudo.



How do I fix the problem?



You'll need to find root-owned files and directories within your home directory and remove them. It's better to remove them than change their ownership in my opinion, as they were not intended for your user, but the root user, so there may be unexpected effects if you simply change ownership. You can of course back them up in case you decide there's something you want in them later.



To find root-owned files in your home directory:



find ~ -user root


If you are still having problems with some applications (run as your user), try rebooting to clear out /tmp and anything still running. Occasionally some applications might have corrupted their existing config files and need you to remove all their configuration in your home directory, but hopefully this won't be the case for many.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 19 at 23:22

























answered Sep 16 '14 at 11:35









thomasrutterthomasrutter

27.2k46789




27.2k46789













  • Thank you for explanation. How can I fix it? Or everybody has the same issue as me?

    – kenn
    Sep 16 '14 at 11:43






  • 3





    By using gksudo instead of sudo when running graphical programs.

    – thomasrutter
    Sep 16 '14 at 11:44











  • So there is nothing wrong in my system.

    – kenn
    Sep 16 '14 at 11:54






  • 2





    Yes, other than the possibility you now have root-owned files in your home directory that shouldn't be root-owned.

    – thomasrutter
    Sep 19 '14 at 0:23



















  • Thank you for explanation. How can I fix it? Or everybody has the same issue as me?

    – kenn
    Sep 16 '14 at 11:43






  • 3





    By using gksudo instead of sudo when running graphical programs.

    – thomasrutter
    Sep 16 '14 at 11:44











  • So there is nothing wrong in my system.

    – kenn
    Sep 16 '14 at 11:54






  • 2





    Yes, other than the possibility you now have root-owned files in your home directory that shouldn't be root-owned.

    – thomasrutter
    Sep 19 '14 at 0:23

















Thank you for explanation. How can I fix it? Or everybody has the same issue as me?

– kenn
Sep 16 '14 at 11:43





Thank you for explanation. How can I fix it? Or everybody has the same issue as me?

– kenn
Sep 16 '14 at 11:43




3




3





By using gksudo instead of sudo when running graphical programs.

– thomasrutter
Sep 16 '14 at 11:44





By using gksudo instead of sudo when running graphical programs.

– thomasrutter
Sep 16 '14 at 11:44













So there is nothing wrong in my system.

– kenn
Sep 16 '14 at 11:54





So there is nothing wrong in my system.

– kenn
Sep 16 '14 at 11:54




2




2





Yes, other than the possibility you now have root-owned files in your home directory that shouldn't be root-owned.

– thomasrutter
Sep 19 '14 at 0:23





Yes, other than the possibility you now have root-owned files in your home directory that shouldn't be root-owned.

– thomasrutter
Sep 19 '14 at 0:23


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • 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%2faskubuntu.com%2fquestions%2f524667%2fls-cannot-access-gvfs-permission-denied%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

Category:香港粉麵

List *all* the tuples!

Channel [V]