0

I know bit about setting permission but i'm little in a mess with it. I'm new to ubuntu so i get little confused and took much time to solve a little problem. I have installed xampp with installer which put it in /opt/lampp i have set Virtual hosts as well i successfully configured my first vhost after spending couple of hours but when i try to create a new one one i lost my access now whenever i open my host url opencart.lh it says access forbidden. i tried to play with chmod but i get lost with it.

Note: i didn't create folder manualy in opt/lampp/htdocs i just copy my existing project to it like opt/lampp/htdocs/opencart.

It might be a duplicate question but i hope you can answer it as well.

Thanks in advance.

Edit -1

My Question is i have added new folder to htdocs i have settled it's permission chmod 755 for directories and chmod 644 for files this worked for my on my first project but with 2nd i used the same method but it didn't work for that one.

Ali Shan
  • 101

2 Answers2

0

In general to change file and/or directories permissions you need to use chmod command (you already knew that).

There is two way to use chmod more information in official ubuntu docs page. In the nutshell either use letters e.g

  • r read (readable)
  • w write (writeable)
  • x execute (executable)

OR use numbers

  • 4 == r

  • 2 == w

  • 1 == x

    Here are some example that you should be able to adapt them for your own use.

chmow 644 *

  • 6 make all files in the current directory readable and writeable for the file owner
  • 4 make all files in the current directory only readable for people in the group
  • 4 make all files in the current directory only readable for everyone else

I don't know equivalent command using letters but to get the same reuslt you would do something like this

chmod a+rw *

  • all can read and write

chmow o-w *

  • others can't write

chmod g-w *

  • group can't write

There are many different ways to change files and directories permission. You should really look at the docs

Serine
  • 163
  • Thanks Serine.. But i have idea about it and i mostly use 7-4-2-1 method to set like chmod 644 filename but my question is not about chmod exactly. It's about that i have added new folder to htdocs i have settled it's permission chmod 755 for directories and chmod 644 for files this worked for my on my first project but with 2nd i used the same method but it didn't work for that one. – Ali Shan Jul 01 '15 at 06:25
0

After little more effort I'm able to work with my htdocs folder. First i set my owner of my htdocs from root to My User

after that i set permission of my htdocs 755 (drwx-rx--rx-) for my all directories in htdocs

User this code to do that

find htdocs -type d -exec chmod 755 {} \;

and for files i set 644 (rw-r-r)

User this code to do that

find htdocs -type f -exec chmod 755 {} \;

and it works fine.

Yapeeee.

Hope someone will find this use full.

Ali Shan
  • 101
  • I'm glad you figured a way to fix the problem. I got a bit lost after your ..chmod 755 .. bit, but never mind. I still don'tt exactly understand the problem. However I though does ownership of the fiels/directories matters..? sometimes if user is the owner you might need to change it to root. Also I think you know that, but when you run chmod maybe you need to do it recursively ..? Cheers – Serine Jul 03 '15 at 01:14