Industry News by Chris (Rain) Avila Oct 16, 2017 Linux Newbies - File Attributes So if you’re new to Linux and you’re coming from a Windows background one of the basic concepts you would need to grasp is the way file permissions work on linux systems. If you’re in your home directory and you run “ls -la” you will likely see a list something like this returned: But what does ay of it mean? Lets take file.txt as an example. The file “file.txt” has the permissions “-rw-rw-r–.” which can also be written as “0664”. A files permissions are essentially broken down into three groups: permissions for the owner, group, and others (in that order). The numerical value assigned to each of these is 4 for read permissions, 2 for write permissions, and 1 for execute permissions. With the permissions given, the owner “bob” has read and write permissions, as well as everyone in the “bob” group. Others can read the file, but can’t make any changes to the file nor execute it. The first dash in the permissions is not actually a permission but is meant to represent the file type. Regular files are marked with a dash “-“ an directories with a “d”. So file permissions are pretty straight forward but how would you change permissions of a file? The three commands you would commonly use to do that are “chmod”, “chgrp” and “chown”. The “chmod” command or “change mode” is what you use to change the access mode(permissions) of a file. To give full permissions to a file you could do “chmod 777” which would grant full access to read, write, and execute for every user (never do this). Say you’re ready to share the file. The first thing you’re going to need to do is to move the file in a folder everyone you want to have access to the file has access to. In the above example we were using bob’s home directory which you can see at the very top only bob has access to (per the “(drwx——)” permissions. So lets move it out to a new directory at /usr/shared with “sudo mkdir /usr/shared && mv /home/bob/file.txt /usr/shared/ && sudo chmod 664 /usr/shared”. Now you’re working out of a folder that you want multiple users have access to but not everyone. Well that’s where groups and the chgrp command would come in. If file.txt had a sick recipe for pumpkin spice cake balls and I wanted Paul to share in the flavor explosion, but not enough to share my supply of pumpkin goodness, I could make make a “bakers” group with “sudo groupadd bakers” and then add Paul to the “bakers” group with “sudo usermod -aG bakers paul”. Then I just give use “chgrp bakers /usr/shared” to give members of the “bakers” group access to the directory which has the file(s) I want others to access. To quickly touch on the some of the other commands used: mkdir is used to make make new directories mv is for moving files from a to b sudo is for executing a command with root privileges If you’re looking for a Linux distribution to give try, I recommend downloading a virtualization tool like virtualbox and an iso of a distribution like Linux Mint as a good place to get started.