permission denied for reading directory owned by the same user

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











up vote
0
down vote

favorite












I have two users on a Ubuntu machine. One of them is in sudoers list, while the other is not. I create a directory in first user's home directory. Then I change the ownership of this directory to the other user. Now when I switch to the other user and try to read this directory, it says permission denied.



I used chown with -R so it applied to everything inside the directory.



The ls -l shows this



drwxr-xr-x 2 lfs lfs 4096 Mar 23 02:07 sources


lfs being the second user.







share|improve this question


















  • 2




    Does the parent directories of the "source" directory have execute permissions for the other user?
    – Kusalananda
    Mar 23 at 14:13










  • Concur with @Kusalananda - check the entire tree leading up to that directory. Chances are that's why you're getting locked out.
    – Shadur
    Mar 25 at 19:43














up vote
0
down vote

favorite












I have two users on a Ubuntu machine. One of them is in sudoers list, while the other is not. I create a directory in first user's home directory. Then I change the ownership of this directory to the other user. Now when I switch to the other user and try to read this directory, it says permission denied.



I used chown with -R so it applied to everything inside the directory.



The ls -l shows this



drwxr-xr-x 2 lfs lfs 4096 Mar 23 02:07 sources


lfs being the second user.







share|improve this question


















  • 2




    Does the parent directories of the "source" directory have execute permissions for the other user?
    – Kusalananda
    Mar 23 at 14:13










  • Concur with @Kusalananda - check the entire tree leading up to that directory. Chances are that's why you're getting locked out.
    – Shadur
    Mar 25 at 19:43












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have two users on a Ubuntu machine. One of them is in sudoers list, while the other is not. I create a directory in first user's home directory. Then I change the ownership of this directory to the other user. Now when I switch to the other user and try to read this directory, it says permission denied.



I used chown with -R so it applied to everything inside the directory.



The ls -l shows this



drwxr-xr-x 2 lfs lfs 4096 Mar 23 02:07 sources


lfs being the second user.







share|improve this question














I have two users on a Ubuntu machine. One of them is in sudoers list, while the other is not. I create a directory in first user's home directory. Then I change the ownership of this directory to the other user. Now when I switch to the other user and try to read this directory, it says permission denied.



I used chown with -R so it applied to everything inside the directory.



The ls -l shows this



drwxr-xr-x 2 lfs lfs 4096 Mar 23 02:07 sources


lfs being the second user.









share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 14:44









Andy Dalton

4,7561520




4,7561520










asked Mar 23 at 13:43









Akash Garg

31




31







  • 2




    Does the parent directories of the "source" directory have execute permissions for the other user?
    – Kusalananda
    Mar 23 at 14:13










  • Concur with @Kusalananda - check the entire tree leading up to that directory. Chances are that's why you're getting locked out.
    – Shadur
    Mar 25 at 19:43












  • 2




    Does the parent directories of the "source" directory have execute permissions for the other user?
    – Kusalananda
    Mar 23 at 14:13










  • Concur with @Kusalananda - check the entire tree leading up to that directory. Chances are that's why you're getting locked out.
    – Shadur
    Mar 25 at 19:43







2




2




Does the parent directories of the "source" directory have execute permissions for the other user?
– Kusalananda
Mar 23 at 14:13




Does the parent directories of the "source" directory have execute permissions for the other user?
– Kusalananda
Mar 23 at 14:13












Concur with @Kusalananda - check the entire tree leading up to that directory. Chances are that's why you're getting locked out.
– Shadur
Mar 25 at 19:43




Concur with @Kusalananda - check the entire tree leading up to that directory. Chances are that's why you're getting locked out.
– Shadur
Mar 25 at 19:43










1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










This is a follow-up to @Kusalananda 's question in the comment associated with your question above.



Suppose that you have two users, user1 and user2. Suppose that user1 has a home directory /home/user1. Now suppose that in the home directory of user1 you create a directory owned by user2, say /home/user1/sources, can user2 access that directory?



In order for user2 to be able to access /home/user1/sources, then user2 needs to have x (traverse) permission on each directory from root, up to and including the sources directory:



$ ls -ld /
dr-xr-xr-x 31 root root 4096 Feb 28 11:37 /
^ Check (this will almost always be OK)

$ ls -ld /home
drwxr-xr-x 4 root root 4096 Feb 28 11:38 /home
^ Check (this will almost always be OK)

$ ls -ld /home/user1
drwx------ 9 user1 group1 4096 Mar 21 00:36 /home/user1
^ ^ In this case, no, user2 cannot traverse here

$ ls -ld /home/user1/sources
drwxr-xr-x 9 user2 group2 4096 Mar 21 00:36 /home/user1/sources
^ Check


In this example, because user2 cannot traverse into /home/user1, user2 cannot access /home/user1/sources (even though user2 owns that directory).



In your question you said that the sources directory is in the home directory of the first user. My guess is that the second user can't access the first user's home directory.



You might consider putting the sources directory somewhere outside of the user's home directory.






share|improve this answer




















  • Thank you. :) i had to use /mnt to create the sources for user lfs to be able to read.
    – Akash Garg
    Mar 27 at 1:45











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%2f433072%2fpermission-denied-for-reading-directory-owned-by-the-same-user%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote



accepted










This is a follow-up to @Kusalananda 's question in the comment associated with your question above.



Suppose that you have two users, user1 and user2. Suppose that user1 has a home directory /home/user1. Now suppose that in the home directory of user1 you create a directory owned by user2, say /home/user1/sources, can user2 access that directory?



In order for user2 to be able to access /home/user1/sources, then user2 needs to have x (traverse) permission on each directory from root, up to and including the sources directory:



$ ls -ld /
dr-xr-xr-x 31 root root 4096 Feb 28 11:37 /
^ Check (this will almost always be OK)

$ ls -ld /home
drwxr-xr-x 4 root root 4096 Feb 28 11:38 /home
^ Check (this will almost always be OK)

$ ls -ld /home/user1
drwx------ 9 user1 group1 4096 Mar 21 00:36 /home/user1
^ ^ In this case, no, user2 cannot traverse here

$ ls -ld /home/user1/sources
drwxr-xr-x 9 user2 group2 4096 Mar 21 00:36 /home/user1/sources
^ Check


In this example, because user2 cannot traverse into /home/user1, user2 cannot access /home/user1/sources (even though user2 owns that directory).



In your question you said that the sources directory is in the home directory of the first user. My guess is that the second user can't access the first user's home directory.



You might consider putting the sources directory somewhere outside of the user's home directory.






share|improve this answer




















  • Thank you. :) i had to use /mnt to create the sources for user lfs to be able to read.
    – Akash Garg
    Mar 27 at 1:45















up vote
2
down vote



accepted










This is a follow-up to @Kusalananda 's question in the comment associated with your question above.



Suppose that you have two users, user1 and user2. Suppose that user1 has a home directory /home/user1. Now suppose that in the home directory of user1 you create a directory owned by user2, say /home/user1/sources, can user2 access that directory?



In order for user2 to be able to access /home/user1/sources, then user2 needs to have x (traverse) permission on each directory from root, up to and including the sources directory:



$ ls -ld /
dr-xr-xr-x 31 root root 4096 Feb 28 11:37 /
^ Check (this will almost always be OK)

$ ls -ld /home
drwxr-xr-x 4 root root 4096 Feb 28 11:38 /home
^ Check (this will almost always be OK)

$ ls -ld /home/user1
drwx------ 9 user1 group1 4096 Mar 21 00:36 /home/user1
^ ^ In this case, no, user2 cannot traverse here

$ ls -ld /home/user1/sources
drwxr-xr-x 9 user2 group2 4096 Mar 21 00:36 /home/user1/sources
^ Check


In this example, because user2 cannot traverse into /home/user1, user2 cannot access /home/user1/sources (even though user2 owns that directory).



In your question you said that the sources directory is in the home directory of the first user. My guess is that the second user can't access the first user's home directory.



You might consider putting the sources directory somewhere outside of the user's home directory.






share|improve this answer




















  • Thank you. :) i had to use /mnt to create the sources for user lfs to be able to read.
    – Akash Garg
    Mar 27 at 1:45













up vote
2
down vote



accepted







up vote
2
down vote



accepted






This is a follow-up to @Kusalananda 's question in the comment associated with your question above.



Suppose that you have two users, user1 and user2. Suppose that user1 has a home directory /home/user1. Now suppose that in the home directory of user1 you create a directory owned by user2, say /home/user1/sources, can user2 access that directory?



In order for user2 to be able to access /home/user1/sources, then user2 needs to have x (traverse) permission on each directory from root, up to and including the sources directory:



$ ls -ld /
dr-xr-xr-x 31 root root 4096 Feb 28 11:37 /
^ Check (this will almost always be OK)

$ ls -ld /home
drwxr-xr-x 4 root root 4096 Feb 28 11:38 /home
^ Check (this will almost always be OK)

$ ls -ld /home/user1
drwx------ 9 user1 group1 4096 Mar 21 00:36 /home/user1
^ ^ In this case, no, user2 cannot traverse here

$ ls -ld /home/user1/sources
drwxr-xr-x 9 user2 group2 4096 Mar 21 00:36 /home/user1/sources
^ Check


In this example, because user2 cannot traverse into /home/user1, user2 cannot access /home/user1/sources (even though user2 owns that directory).



In your question you said that the sources directory is in the home directory of the first user. My guess is that the second user can't access the first user's home directory.



You might consider putting the sources directory somewhere outside of the user's home directory.






share|improve this answer












This is a follow-up to @Kusalananda 's question in the comment associated with your question above.



Suppose that you have two users, user1 and user2. Suppose that user1 has a home directory /home/user1. Now suppose that in the home directory of user1 you create a directory owned by user2, say /home/user1/sources, can user2 access that directory?



In order for user2 to be able to access /home/user1/sources, then user2 needs to have x (traverse) permission on each directory from root, up to and including the sources directory:



$ ls -ld /
dr-xr-xr-x 31 root root 4096 Feb 28 11:37 /
^ Check (this will almost always be OK)

$ ls -ld /home
drwxr-xr-x 4 root root 4096 Feb 28 11:38 /home
^ Check (this will almost always be OK)

$ ls -ld /home/user1
drwx------ 9 user1 group1 4096 Mar 21 00:36 /home/user1
^ ^ In this case, no, user2 cannot traverse here

$ ls -ld /home/user1/sources
drwxr-xr-x 9 user2 group2 4096 Mar 21 00:36 /home/user1/sources
^ Check


In this example, because user2 cannot traverse into /home/user1, user2 cannot access /home/user1/sources (even though user2 owns that directory).



In your question you said that the sources directory is in the home directory of the first user. My guess is that the second user can't access the first user's home directory.



You might consider putting the sources directory somewhere outside of the user's home directory.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 23 at 15:31









Andy Dalton

4,7561520




4,7561520











  • Thank you. :) i had to use /mnt to create the sources for user lfs to be able to read.
    – Akash Garg
    Mar 27 at 1:45

















  • Thank you. :) i had to use /mnt to create the sources for user lfs to be able to read.
    – Akash Garg
    Mar 27 at 1:45
















Thank you. :) i had to use /mnt to create the sources for user lfs to be able to read.
– Akash Garg
Mar 27 at 1:45





Thank you. :) i had to use /mnt to create the sources for user lfs to be able to read.
– Akash Garg
Mar 27 at 1:45













 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433072%2fpermission-denied-for-reading-directory-owned-by-the-same-user%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