Ubuntu – Files are read-only after copying over samba

chmodfile-sharingsamba

I used to copy files from one system to another system via samba. How ever I am getting the file only in read only mode. What i am doing now is i used to change the file permission after transferring the file. It seems to be little time consuming one. Is there any permanent solution to this problem?

Files are read-only after copying over samba

Still i have the same problem. Pls have a look @ my samba setup.

http://paste.ubuntu.com/614067/

Output:

karthick@karthick:~$ groups            
karthick adm dialout cdrom plugdev lpadmin admin sambashare

Best Answer

Configure create mask and directory mask in /etc/samba/smb.conf with the desired permissions.

from /etc/samba/smb.conf:

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
;   create mask = 0700

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
;   directory mask = 0700

If you need more information there is a man page on smb.conf.

Regarding the values for the masking:

Permissions 700 means:

                 : The 1st octet are permissions for the owner.
        r w x  T : The 2nd octet are permissions for the group.
Owner:  4 2 1  7 : The 3rd octet are permissions for everyone else.
Group:  0 0 0  0 : For each octet, start at 0 and:
Other:  0 0 0  0 :  +4 for read permission.
                 :  +2 for write permission.
                 :  +1 for execute permission.

So you need to figure out want permissions you need for the owner,group and others. Add the digits for read, write and execute for owner,group and other.

755 would r,w,x for owner; r,x for group and others.
777 would be r,w,x for all 3.

edit:

If you have problems with locks check if there is a *ldb file (that's the lock file) with permissions lower than 770. If their is check these settings and their values (values and workgroup are arbitrary):

force group = workgroup force create mode = 0770 force directory mode = 0770 force security mode = 0770 force directory security mode = 0770

Samba will then create the *ldb file with rwxrwx--- and be able to remove the locks.

Related Question