Open In App

How to Chmod 777 all Subfolders of /var/www

Last Updated : 15 Sep, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

In Linux, chmod is a command, which is used to change the permissions of files and folders. We can change permissions of Read/Write on a single file, on a single folder, or recursively other subfolders as well. chmod is used to read the current file and write it. S/rwxwxw writes files into one directory or another in RAM using traditional methods like hard-coding bytes by subtracting each byte from their corresponding block name + 1 space (note how S/r can also be replaced with WX ). This allows us: If we are inside a directory within /var/lib/rrdcached then you might want your root account to be in this dir because they will have access from outside that location (via sudo) so no need for using their special rights when reading content directly.

It works like this: It’s quite powerful when combined with mkdir. For example, sudo chown -R root /tmp/newpassword sudo mv newuser /bin:/usr/$#(date +%Y-%m-%d)$NewPasswordOK.txt By using that syntax we can create multiple accounts on one system by including them after they have been created before booting any Linux distribution or machine (they will then be visible as non-root users). 

How to Chmod 777 all Subfolders of /var/www?

Upon logging into a computer, files and directories receive specific access levels to safeguard data and system security. However, users may not know their directories’ maximum permission levels, leading to access issues. For instance, not knowing the permission for /var/www can block web page access. To help users understand access levels, we’ll discuss changing them on a server.

/var is a directory for temporary data, usually found at /var/www on Unix-based systems. Its default permission is 0666 (‘rw-rw-rw’), allowing any user or program to modify the data. The maximum permission for /var is 777, granted only by the directory owner through changing permission numbers. To change permissions, you need administrator access either by logging in or using the sudo command. Start by setting permission numbers to 777 to grant files more access, then use the chmod command to modify specific permissions for each folder in /var.

On Mac OS, access administrator mode by typing “sudo” followed by your command and password. For example, “sudo chmod 777 /var/www” changes the permissions for /var/www. On Windows, open Command Prompt as an administrator, navigate to /var/www, and set permissions using “chmod 777 /var/www.”

When using a computer for the first time, users should learn the allowed access levels for each directory to troubleshoot web browser issues efficiently and avoid confusion with potential server lockouts. Understanding how to manage system security settings benefits all computer users.

Command 

sudo chmod -R 777 /var/www

  • sudo – admin access
  • chmod – command for permissions
  • -R – recursively for all subfolders
  • 777 – Read and write all permissions, and variables based on the need
  • /var/www – path

We can view the permissions using ls -l inside a folder to see the permissions.

akash:/$ sudo chmod -R 777 /var/www  
akash:/$ ls -l

Fig 1.1 Using chmod command to change permissions

Fig 1.1 Using chmod command to change permissions

Now, we have to view the properties of the www folder, so moving into var.

akash:/$ cd var 
akash:/var$ ls -l

drwxrwxrwx – means Read/Write/Execute Access is granted.

Fig 1.2 - Permissions changed output

Fig 1.2 – Permissions changed output

Conclusion

In this article we have learned about managing permissions in Linux which are crucial for data security and system integrity. The chmod command allows users to modify access levels, and for directories like /var/www, setting permissions to 777 using “sudo chmod -R 777 /var/www” grants read and write access to all subfolders. Properly managing permissions empowers users to troubleshoot access issues effectively, ensuring a secure computing environment and contributing to a smoother and safer experience.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads