How-to: Set rights for /var/www when using Apache under Ubuntu

If you’re new to Joomla or are a casual user, and you’re trying to set up a LAMP server, you could run into some problems.  One problem that often bugged / bugs me, was settings the file permissions in the /var/www folders just right.  I either gave everyone full rights or created some freak kind of setup where everyone could FTP to the server, visit all pages and could download / upload files, but where the administrator couldn’t copy a single file when on the server.  But that’s not the point of this post.  This post is going to teach you how to set your File Rights in a proper, working way under Ubuntu.

Creating Groups

First of all, we’ll need to create a group which will have sufficient rights.

1.  Using the Ubuntu GUI:  Go to System > Users and Groups.  Click Unlock, and then choose “Manage groups”.   Click “Add Group”, then select “settings” for that group.  There, select all users that should be a member of that group, like Root, Administrator (or whatever your default user is), and other users (e.g I use a user, “ftp-user”, which is used for the FTP server).

Using the Terminal (a.k.a “The fast way”), enter the following commands:

sudo addgroup (your group name)

sudo adduser (user) (group) –> Repeat this command if neccessary.


Setting the user rights

2.  Now, we’re going to set the user rights.  I’m not 100% sure that my way is the BEST way, but it worked for me.  You’re going to have to use the terminal here, and use the following commands:

sudo adduser www-data (yourgroup)

sudo chgrp (your group) /var/www

sudo chmod –R 775 /var/www

sudo chmod g+s /var/www


If you’ve followed these steps, you should be able to do it all: visit your websites, upload and download (In my case, using Joomla to install modules etc.) and perform actions in the GUI (copying, deleting etc. etc.)

Enjoy your now usable files!

8 thoughts on “How-to: Set rights for /var/www when using Apache under Ubuntu”

  1. Pingback: Toretto's corner » How-to: Install Apache, Mysql and PHP on Ubuntu

  2. Pingback: One year anniversary « Joomla and more

  3. Pingback: Martin Todorov Multimedia Scripts and Muses » If joomla doesn’t have rights on your ubuntu server

  4. life saver =)

    also i added www-data group to my dev user.. works like a charm!

Comments are closed.

Discover more from PowerUser Guide

Subscribe now to keep reading and get access to the full archive.

Continue reading