Score:0

Will I break things if I use "sudo chmod -R u=wrx {user}"?

cn flag

I am new to linux and Ubuntu. I am learning the terminal and want to set up my userspace as secure as possible. I have multiple users and some have access to files of other users. I want to make sure they can only access the files and folders I set up. So I gave certain folders a public subgroup " chown {usergroup}:{publicgroup} {folder} ", and set that group permission to read and execute " chmod g+rx {folder} ". The group {publicgroup} already contains the necessary users.

BUT, I am concerned that the others and group part of the permissions still says r-x on many files/folders. I was thinking of taking the rwx permissions away from everyting excecpt the few folders and files that I want the group access to using the above command and going back throught to add some rx permissions. Will executing the above chmod command break things? How would you-the community- recommend setting up secure, isolated userspaces while still sharing files. Thanks for helping me! I am still a linux newbe.

waltinator avatar
it flag
If you make a global permissions change to any system directory, you will break your system unrecoverably. System permissions are carefully set, and shouldn't be messed with. What you're trying to do is unclear. Are you familiar with the Owner/Group/World, Read/Write/Execute access scheme used by Unix/Linux? Read `man -a chmod`.
apmech707 avatar
cn flag
Thanks fo the man page hint. I'll read through that. Yes, I am sorta familiar with the owner/group/world and read/write/execute scheme but it is still confusing me a little. I just what to have a guest user that can access one folder. But not let any other folders or user access anything else.
apmech707 avatar
cn flag
Also, I realize using that command on root or like /bin would certainly break things. But I was talking about /home/me folder
Score:1
cn flag

First, the command chmod u=rwx will not do what you intend. It will set the owner permissions to read+write+execute but will leave the group and world permissions untouched. What you want is chmod go-rwx.

Second, you do not want to set the execute permission bit indiscriminately on all files as described in your question. The execute permission should only be set on files that are intended to be executed as programs.

Third, it's never a good idea to sweepingly change the permissions on other users' files without asking them first whether they had a good reason to set the permissions as they are. You have a high chance of breaking things like that.

And finally, if you take away group and world execute permission on a user's home directory then other users cannot access any file or directory within that home directory, even if the permissions on that file or directory itself would allow it.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.