F5F Stay Refreshed Software Operating Systems Yes, I can assist with setting up basic file permissions in a Linux script using chmod.

Yes, I can assist with setting up basic file permissions in a Linux script using chmod.

Yes, I can assist with setting up basic file permissions in a Linux script using chmod.

J
jbradical123
Member
131
08-05-2016, 01:04 PM
#1
J
jbradical123
08-05-2016, 01:04 PM #1

S
Sh4rKai
Member
64
08-13-2016, 03:20 AM
#2
chmod is pretty easy and there's a few ways to write it. I prefer the numeric system. chmod 644 nameOfFile Or in the event of a script: chmod 744 nameofscript The first digit represents the read/write/execute permissions for the owner of the file The second = group The third = other So lets say I wanted to make a script and only wanted the owner to be able to use it in any way at all I'd go: chmod 700 nameofscript But usually group & other have read permissions on files that are created with default permissions so you'd ordinarily use 744. It all depends on the permissions you want the users to have. Here's a more explanatory table I'm "borrowing" from the internet: chmod 400 file To protect a file against accidental overwriting. chmod 500 directory To protect yourself from accidentally removing, renaming or moving files from this directory. chmod 600 file A private file only changeable by the user who entered this command. chmod 644 file A publicly readable file that can only be changed by the issuing user. chmod 660 file Users belonging to your group can change this file, others don't have any access to it at all. chmod 700 file Protects a file against any access from other users, while the issuing user still has full access. chmod 755 directory For files that should be readable and executable by others, but only changeable by the issuing user. chmod 775 file Standard file sharing mode for a group. chmod 777 file Everybody can do everything to this file. The Sauce because I'm not interested in plagiarism.
S
Sh4rKai
08-13-2016, 03:20 AM #2

chmod is pretty easy and there's a few ways to write it. I prefer the numeric system. chmod 644 nameOfFile Or in the event of a script: chmod 744 nameofscript The first digit represents the read/write/execute permissions for the owner of the file The second = group The third = other So lets say I wanted to make a script and only wanted the owner to be able to use it in any way at all I'd go: chmod 700 nameofscript But usually group & other have read permissions on files that are created with default permissions so you'd ordinarily use 744. It all depends on the permissions you want the users to have. Here's a more explanatory table I'm "borrowing" from the internet: chmod 400 file To protect a file against accidental overwriting. chmod 500 directory To protect yourself from accidentally removing, renaming or moving files from this directory. chmod 600 file A private file only changeable by the user who entered this command. chmod 644 file A publicly readable file that can only be changed by the issuing user. chmod 660 file Users belonging to your group can change this file, others don't have any access to it at all. chmod 700 file Protects a file against any access from other users, while the issuing user still has full access. chmod 755 directory For files that should be readable and executable by others, but only changeable by the issuing user. chmod 775 file Standard file sharing mode for a group. chmod 777 file Everybody can do everything to this file. The Sauce because I'm not interested in plagiarism.

I
i3z___
Senior Member
559
08-14-2016, 02:33 PM
#3
Is this a one-off file that you need to create? chmod 750 <file> is the proper command. 7 is RWX for owner, 5 is RX for the group, and 0 is for everyone else. After you create the file, you also need to change the ownership with chown <department head>:<department> If you need any newly created files in a directory to have specific permissions by default, access control lists are the proper way to do that.
I
i3z___
08-14-2016, 02:33 PM #3

Is this a one-off file that you need to create? chmod 750 <file> is the proper command. 7 is RWX for owner, 5 is RX for the group, and 0 is for everyone else. After you create the file, you also need to change the ownership with chown <department head>:<department> If you need any newly created files in a directory to have specific permissions by default, access control lists are the proper way to do that.