0

I know similar questions have been asked, but I couldn't find a solution because I'm not looking for a command to give new rights to the directory, I would like to understand it. I'm very new to Ubuntu, have installed the server and Apache2 (not LAMP, or at least not aware of it). I access the server by SFTP. I would like to move my existing website to the /var/www directory, but of course by default I don't have permission to copy files and folders.

I'm not looking for a code, but can somebody explain to a beginner: What is the way to go in such a case? I have trouble to believe that the first thing I have to do is to lower the permissions. Thanks

Zagawiguay
  • 19
  • 2

3 Answers3

0

The permissions of /var/www can be found by executing the command:

stat -c "%a %n" /var/www/ It returns 755 /wav/www/

Owner can read and write and execute, Group can read and execute, and Others can read and execute.

But root owns /var/www so you either have to be root to add files, or change the permissions so anyone can write.

See this answer for more details what those permission actually mean.

Tim
  • 33,500
0

I have trouble to believe that the first thing I have to do is to lower the permissions.

Well, it is. ;) On your system, you are both a user and an administrator. Administrator-you gets to decide who has access to what. If administrator-you decides that user-you must have access to /var/www, then changing the permissions and/or ownership of that folder is the correct thing to do. In some cases (if the directory in question is group-writable) adding user-you to the relevant group will be sufficient, the point is that administrator-you needs to take whatever action is necessary and sufficient. (Determining exactly what that is takes both knowledge of how permissions work and experience. There are plenty of resources about the former, such as provided by others here.)

fkraiem
  • 12,813
0

You can check the permission:

First go to the base directory and fire this command

$ls -la var/www
Prakash H
  • 2,631