doubt
anyone knows what this means?
what exactly should I do here
2 Replies
that's a linux command that changes the owner of the folder
/var/www/html/example.com
to the user www-data
, and the group www-data
which is the user and group that the webserver runs under
sudo
means "run this as a super user", (SuperUser DO), meaning root
chown
is the command to change file system ownership of a file or folder
-R
is the flag to do so recursively, meaning it'll take the argument and if it's a directory, it'll also process all the files and directories inside the first one, and any under those, and so on
www-data:www-data
is the way you tell chown
to change the user to the first part before :
and the group to the second part. A lot of users on linux also have a group with the same name.
the last part is the directory getting changed
filesystem permissions are a basic part of how Linux works.
Everything in linux is a file, from the actual files on disk, to the devices in your computer, and a bunch of utilities like /dev/null
which is a fake device that just accepts whatever data you give it and then discards it.
Every file has a mask that determines what permissions the owner, group, and everyone else has on the file. The possible permissions are Read Write and eXecute (which means run if it's a file, or open if it's a directory)
Every file also has an owner and a group associated with it.
Each process runs under a certain user and group in linux. So when a process tries to access a file, the operating system checks to see if the user and group running the process have access to the file by checking if the file is owned by the user or group, or if the file is just generally accessible.
because the webserver runs under the www-data
user, the place where your website's files are stored need to be accessible to that user. The easiest way to do that is to make the files in that folder owned by the user www-data
they're also just adding in www-data
as a group, for good measure
@AldrinWow, thanks for the detailed explanation 👍