Posts

Showing posts from July, 2015

Linux: Files membership and modes

Linux: Files membership and modes Everything in Linux is a file, even your video card is a file, and you need a way to control the user access to those files. Files ownership A file is owned, by default, by a user and a group. Beside that, there is another concept, called "other", which means everyone else. When you are creating a file, the owner of the file is your user and your default group. Let's create a file called "myfile": $ touch myfile $ ls -l myfile -rw-r-xr--    1 smocanu  smocanu         0 Jul 14 05:50 myfile In my case, the user who owns this file is "smocanu" and the group is "smocanu". You can change any of this at any point, using chown/chgrp tools. For example, to change the user that owns this file you need run, as root or with sudo: $ sudo chown nginx myfile $ ls -l myfile -rw-rw-r-- 1 nginx smocanu 0 Jul 14 05:54 myfile You can also change both user and group with the same command: $ sudo chown smocanu: