0

/etc/passwd

[..]
seagate:x:1000:1001:,,,:/mnt/seagate/:/bin/false
medion:x:1002:1003:,,,:/mnt/medion:/bin/false
seagate_ro:x:1001:1002:,,,:/mnt/seagate:/bin/false
wwwusr:x:1003:1005:,,,:/var/www:/bin/false

/etc/group

[..]
www-data:x:33:www-usr
seagate:x:1001:
medion:x:1003:
seagate_ro:x:1002:
wwwusr:x:1005:

pdbedit -L

[..]
wwwusr:1003:
medion:1002:
seagate:1000:
seagate_ro:1001:

/etc/samba/smb.conf

[global]
        netbios aliases = refly1 refly2 refly3 refly4 refly5
        workgroup = WORKGROUP
        server string = %h server (Samba %v)
        log file = /var/log/samba/log.%m
        max log size = 1000
        encrypt passwords = true
        invalid users = root
        socket options = TCP_NODELAY
        security = user
        unix extensions = yes

[homes]
        comment = Home Directories
        browseable = no
        valid users = %S
        writable = no
        write list = seagate medion wwwusr
        create mode = 0600
        directory mode = 0700

testparm

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

In windows explorer

M: \\refly2\medion
S: \\refly3\seagate
W: \\refly1\wwwusr

ls -ld /var/www

drwxr-xr-x 2 777 www-data 4096 Mai  9 13:29 /var/www

Problem: Can not create, delete or rename files with wwwusr. If I use seagate, seagate_ro (ro = read only) or medion to access their home directories they do their job perfectly. So where is the problem?

To setup my samba I used this guide.

4
  • What are actually the permissions set on /var/www ?
    – krisFR
    May 9, 2015 at 12:33
  • I don't know. How to proof that? I deleted the whole folder and recreated it a couple of hours ago.
    – Tomblarom
    May 9, 2015 at 12:35
  • Run ls -ld /var/www and provide result
    – krisFR
    May 9, 2015 at 12:38
  • Added to main thread.
    – Tomblarom
    May 9, 2015 at 12:39

1 Answer 1

0

As you can see using :

ls -ld /var/www
drwxr-xr-x 2 777 www-data 4096 Mai  9 13:29 /var/www

The /var/www folder is owned by user 777 (?) which have rwx permissions as it is the owner.

Then, www-data group has rx permission.

Finally, all others users, including your wwwusr user has rx permissions.

Alternative 1

If you have a website setup and running in /var/www i would do the following to not break things on your working website :

  1. Add user wwwusr to the additional group www-data :

    usermod -G www-data wwwusr
    
  2. Then give write permissions to group www-data on the folder :

    chmod g+w /var/www
    

Alternative 2

If this don't break the website you may be running (test it), just make user wwwusr the owner of the folder :

chown wwwusr:wwwusr /var/www

Edit about permission :

In your Samba config you use :

create mode = 0600

This tells Samba that each new created files will have rw permissions only for the owner :

-rw------- 1 wwwusr wwwusr 65 Mai 9 15:08 /var/www/index.html

You may change it to :

create mode = 0605

This will add rx permissions to other users.

The above also applies to this directive you use :

directory mode = 0700

It will give rwx permission to owner only on each newly created folders. No permissions to group nor others.

Use directory mode = 0705 to add rx permissions to others on folders.

==> Warning : all these will also affect permissions for others users home directories content the same way. As discussed, it is not a problem for you.


10
  • Aww that simple? Thank you, that fixed it! I'm new to linux and I think I'm right here!
    – Tomblarom
    May 9, 2015 at 12:52
  • Now I'm getting another error: 404 Forbidden You don't have permission to access /index.html on this server. The index.html has been created by notepad.exe over \\refly1\wwusr.
    – Tomblarom
    May 9, 2015 at 12:57
  • Please see my edit regarding alternatives. What is the result for ls -l /var/www/index.html ?
    – krisFR
    May 9, 2015 at 13:02
  • -rw------- 1 wwwusr wwwusr 65 Mai 9 15:08 /var/www/index.html. The files has been created by wwwusr. A index.html, created by nano index.html is perfectly working. If i edit this file by notepad++ it's still working.
    – Tomblarom
    May 9, 2015 at 13:08
  • Try this : chmod o+rx /var/www/index.html
    – krisFR
    May 9, 2015 at 13:11

You must log in to answer this question.

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