Getting access to var/www
Solution 1
First of all, had you install a server as lampp? Is you did, the files sould be at some place as /opt/lampp/htdocs
.
Assuming that the htdocs directory is on /var/www, you could change the permissions like this (in a Terminal, open it by searching Terminal on the Dash):
sudo chmod -R 777 /var/www
sudo chown -R **yourusername** /var/www
You must change yourusername with the username you entered in the installing process.
I hope it works to you!
Solution 2
First of all, you can see the permission of /var/www has, by this command ls -l /var/www
. You will see like this (this only for example):
drwxr--r-- 7 www-data www-data 4096 Jun 21 10:53 CodeIgniter
drwxr--r-- 11 www-data www-data 4096 Oct 2 19:49 eAdministration
drwxr-sr-x
is permission status and www-data www-data
is ownership status. By default, when you installed for first time, ownership status is www-data www-data
. The thing that you should do, add your username belongs to www-data
group by this command:
sudo adduser yourusername www-data
After that, you should change the ownership to your username:
sudo chown yourusername:www-data -R /var/www
It will result in:
drwxr--r-- 7 yourusername www-data 4096 Jun 21 10:53 CodeIgniter
drwxr--r-- 11 yourusername www-data 4096 Oct 2 19:49 eAdministration
Then, you should change permission to 755 (rwxr-xr-x) for directories, 644 (rw-r--r--) for files, and I do not recommend to change permission to 777 (rwxrwxrwx). As suggestion from temoto to make easier to be understand, you can do this:
sudo find /var/www -type d -print0 | sudo xargs -0 chmod u=rwX,go=rX
sudo find /var/www -type d -print0 | sudo xargs -0 chmod u=rw,go=r
OR
sudo find /var/www -type d -print0 | sudo xargs -0 chmod 0755
sudo find /var/www -type f -print0 | sudo xargs -0 chmod 0644
To ensure that setting has been running well, you can try php code in /var/www.
Related videos on Youtube
Matt Jones
Updated on September 18, 2022Comments
-
Matt Jones over 1 year
I'm building an html email template and need to remove the spacing between table rows, but need to keep the cellspacing at 10px. You will see in the example blue title bars and the spacing beneath them. Is there any way to isolate those table rows using CSS and remove this?
HTML: http://www.tailwatersflyfishing.com/email/template/new.html
-
DreamTeK over 10 yearsYour example is not very clear however I would recommend you remove cell spacing from table and separate tables using css margin and padding.
-
-
gertvdijk over 11 years-1 for
chmod
ing to 777. Not necessary and also makes file appearing as executables. Hard to revert it. -
Viktor over 11 yearsAs I guess you know more about Ubuntu then me, I assume I made the installation wrong. I followed a guide so I guessed it would work. Could you guide me though uninstall and reinstall? or give suggestion guide? Thanks!
-
Addison Montgomery over 11 yearsDid you install any software for the HTTP server such as Apache, LAMPP (XAMPP) or anything like that? I think that Ubuntu Desktop hasn't any server installed by default, so if you installed something, please tell me and i'll be glad to help you. Else, if you had not installed anything, I'm sure that someone could help you to do it :)
-
gertvdijk almost 11 yearsWith setting 755 recursively, all files will be set as executable. You don't want that, really.
-
kevinius over 10 yearsIf you are targeting a wide range of email clients, then the only option here is to use tables for layout purposes...
-
Chad over 10 yearsAh yea, I've never designed for email. Regardless, there's still a fix in there :)
-
temoto about 8 yearsNowadays chmod recognise
X
permission asx
for directories and empty for files. It's possible to runfind /var/www -print0 |xargs -0 chmod u=rwX,go=rX
. With added benefit of easier to understand permissions. -
Peter Krauss about 7 yearsERROR, no permission for my user (that was in adduser suggested), at
/var/www/html
I can not docat > test.txt
even with sudo! (I used last options ofsudo find etc
also) -
5d41402abc4 about 7 yearsFirst, could you try to find what groups are your user belongs to? Try to type
groups <username>
-
AntonK almost 6 yearsThere is a typo in
sudo find /var/www -type d -print0 | sudo xargs -0 chmod u=rw,go=r
, which will list directories (-type d
) instead of files (-type f
).