RSS

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

28 Oct

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!

Advertisement
 

About Steven Zeegers

My business card says IT administrator, but my hobby is running Joomla-and-more.com (Joomla, IT) and Toretto.be (Video games). Gamer when possible, regular found @ the movies.
4 Comments

Posted by on October 28, 2009 in IT Tips & Tricks

 

Tags: , , , ,

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

  1. Krishna Kumar T M

    October 23, 2011 at 7:17 pm

    It workzzzzzzz thankzzzz dude.

     
  2. Anybris

    February 1, 2012 at 11:34 pm

    Thanks a Lot!!!!! You Save my life

     

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 466 other followers