0

I'm doing a homework assignment for a Linux class I'm taking and I need to make it so users other than the owner cannot list, delete, or create any files within a directory. They also must still be allowed to access the files (assuming they know the directory and file name since they aren't allowed to list it), but are not allowed to modify or execute. I already have it so the users cannot modify or execute with the chmod, but I'm not sure how to go about stopping users from listing or deleting files in the directory.

2 Answers 2

1

If your username is alex and the folder name is homework,

  1. try
    chmod -R 700 homework

from your login

  1. ensure the owner is alex. Else change ownership using the command

chown alex:alex homework

Now login using another username and execute

ls homework

you should get permission denied error

Sign up to request clarification or add additional context in comments.

4 Comments

alright thanks. To allow the users other than Alex to access the file, but still not modify or execute would I just do chmod 744? What does -R do? One more thing too, I'm required to take execute permissions from alex, but after doing so, I'm not allowed (as alex) to list or even modify the directory even though read or write is still on. So I guess the question here is what exactly does the ability to execute allow one to do?
@Alex5775 Yes 744 should work. -R is recursive which means the 700 is applies to all files inside the folder homework. You can only execute, but cannot read/write when you just enable the 'x' in rwx.
Thanks again, you've really helped me understand the operating system better thus far, but in the example I gave I took execute away and left read and write as permissible, so I'm just wondering why I can't list the items, cd into homework, or create a new file or directory within readable when I take only execute permission away.
hopefully it should work. Check the ownership of the folder and permissions. You can experiment with it
0

"Users other than the owner"

So we're talking about the groups and other

"Cannot delete, create [...] modify or execute it"

Remove the wx rights for the others and groups :

chmod -R g-wx o-wx /path/to/your/file 

Quick chmod recap :

  1. u = owner of the file (user)
    g = groups owner (group)
    o = anyone else on the system (other)

  2. add permission (+)
    remove permission (-)

  3. r = read permission
    w = write permission
    x = execute permission

About preventing them from listing a directory , I dont know if it is possible but you can probably find what you're looking for by reading here:
http://www.penguintutor.com/linux/file-permissions-reference
and here : https://askubuntu.com/questions/200911/how-to-prevent-access-to-a-folder-by-other-users

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.