1

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

1
  • No, it's not a duplicate, because there I find tons of code how to change the permissions. What I was looking for was a conceptual understanding for a newbie. Which I got answered from yourself and below: Not changing permission of the folder, but increasing my user-permissions. Thanks!
    – Zagawiguay
    Jul 11, 2014 at 13:22

3 Answers 3

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.

1
  • Thanks for the feedback. It helps to figure out the file rights. I tend to change the permissions on my user, but I'm keeping an eye on this board for now, since I'm an absolute beginner in this subject.
    – Zagawiguay
    Jul 11, 2014 at 13:30
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.)

8
  • No, you don't lower the permissions of the directory. You increase your own privileges by adding yourself to the appropriate group.
    – Dan
    Jul 11, 2014 at 12:51
  • 1
    @dan08 Is /var/www group-writable by default? (I don't have an Ubuntu system at hand to test right now.)
    – fkraiem
    Jul 11, 2014 at 12:56
  • And in any case, this does not work as a general principle, since files/directories are generally not group-writable, so you will have to change the permissions anyway.
    – fkraiem
    Jul 11, 2014 at 13:02
  • Maybe you could clarify your answer.
    – Dan
    Jul 11, 2014 at 13:18
  • First of all, thanks already. It's interesting to see that there are different opinions around. As a newbie I don't really know where to go now. I guess I will start reading the introduction into Ubuntu Permissions and check back here and see where this is going. But I'm thankful for all of your inputs, because this is exactly the part that I don't understand yet.
    – Zagawiguay
    Jul 11, 2014 at 13:28
0

You can check the permission:

First go to the base directory and fire this command

$ls -la var/www

Not the answer you're looking for? Browse other questions tagged .