Jump to content

Files created from Windows box on Linux box don't get correct permissions.


JasonLewis

Recommended Posts

Okay, I set up samba so that it shares my /var/www directory so that I can gain access from my Windows box. The reason I did this was so that I could run NetBeans from my Windows box and edit files inside my /var/www directory.

 

I've set up multiple sites so they are all stored in /var/www/sites/<sitename>/htdocs

The problem is when I create a file from NetBeans it gives it incorrect permissions. Running ls -l from inside htdocs outputs this:

 

-rw-r--r-- 1 jason www   19 2010-09-03 18:42 index.php
drwxrws--x 3 jason www 4096 2010-09-03 18:34 nbproject
-rwxrw---- 1 jason www  511 2010-09-03 18:43 netbeans_file.php

 

index.php was created from SSH, and my linux isn't great but from looking at it index.php has read permissions for every group, and the owner can write too it (does it need execute?). However the netbeans_file.php (which was created from inside NetBeans), doesn't have any permissions for other.

 

I'm kind of lost here, I can manually assign permissions to the file from SSH (chmod 644), however I'd prefer if files gained permissions when created.

 

I'm not even sure where to start...

Link to comment
Share on other sites

This is what I have, which I ended up with after following a tutorial.

 

[www]
comment = www directory
path = /var/www
public = yes
writable = yes
valid users = jason
create mask = 0771
directory mask = 0771
force user = jason
force group = www

 

So create mask should be 022?

 

I change create mask = 0771 to 022 and now when I create files I get the following permissions:

 

-----w--w- 1 jason www    0 2010-09-03 20:11 test.php

 

NetBeans also says this: Cannot lock read-only file \\jcl-webserver\www\sites\home\htdocs\test.php

 

Edit:

 

I changed the create mask to 644 and now the permissions are set to the same as when created through SSH.

I take it this is the right way?

Link to comment
Share on other sites

  • 4 weeks later...

Looking at his configuration data he is using group www.  Now I agree with you in that on the Ubuntu machines I've used Apache2 runs as www-data.  However on a CentOs box I administer it runs as user and group apache2 or httpd, I forget which, but it's not www-data.

 

In any case I still stand by my statement:

If user and / or group have read and his web server runs as either that user and / or group, then there's no need to grant read access to other.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.