4

I have server with samba share, which is mounted by CIFS on my client machine under /media/photos.

/media/photos ownership is root:samba, and my user also is member of group samba. In smb.conf on server I have:

force create mode = 0664
force directory mode = 2775
force security mode = 0664
force directory security mode = 2775

So /media/photos directory has rights drwxrwxr-x. Every file that I create in this directory has rights rw-rw-r--

I can create directory. I can create file. I can go into created directory and create file there.

I can't copy directory tree. When I issue:

cp -r /home/frank/photos/Tymek/ /media/photos

Directory "Tymek" is created, but no files inside. I get messages like

cp: cannot create regular file `/media/photos/Tymek/usg_10.bmp': Permission denied

Even if I can go into Tymek directory and create file without any problem.

Such command works:

cp -r /home/frank/photos/Tymek/ /media/photos/

(slash at the end added)

But Nautilus seems to use first method, it has problems copying whole directories, and I need it.

6
  • The first "cp -r", without the trailing /, is (as can be seen from the error) trying to create a directory at /media/photos and not at /media/share/photos/... So perhaps the problem lies elsewhere?
    – jrg
    Sep 28, 2009 at 0:18
  • It was copy-paste mistake. Fixed.
    – amorfis
    Sep 28, 2009 at 7:09
  • Can you copy/paste without the trailing slash into other folders that are not SMB shares? Sep 28, 2009 at 21:36
  • Yes, I can copy into other folders. Problem is only with the one mounted by CIFS.
    – amorfis
    Sep 29, 2009 at 11:10
  • What's the output of "ls -l /home/frank/photos/Tymek/usg_10.bmp", "ls -ld /media/photos/Tymek" and "id"? Are there any symlinks involved in the source path, or perhaps partially encrypted filesystems? Sep 30, 2009 at 17:02

5 Answers 5

3

This may help, OS X 10.5 had similar problems with our Samba until a magic set of smb.conf permissions was applied that stopped the same sort of no permissions issues. Try replacing/amending your values with these:

    create mask = 0664
    force create mode = 0664
    security mask = 0000
    force security mode = 0664

    directory mask = 0775
    force directory mode = 0775
    directory security mask = 0000
    force directory security mode = 0775

I can't guarantee this will fix you, but it took a lot of tweaking to solve the same problem for these Mac clients.

1
  • It worked. Thanks! create mask and directory mask seems crucial. I ommitted it before because there was force anyway, but apparently it is needed.
    – amorfis
    Nov 25, 2009 at 21:38
1

Sounds much like a problem I had, too. Please check that when you copy a folder which contains only files and no other subfolders and the folder does not exist on the destination that you get a "permission denied" at first but that you can copy it without problems right afterwards. E.g.

$ mkdir testdir
$ touch testdir/somefile
$ rm -r /media/photos/testdir
$ cp -r testdir /media/photos
cp: cannot create regular file `/media/photos/testdir/somefile': Permission denied
$ cp -r testdir /media/photos
$ # same command works

This has been discussed at Ubuntuforums: smbmount: cannot create regular file. I've posted there as "xrat". I still think this is a bug (I just didn't have time to report it yet). Adding noperm to the mount options helps. But it's a dirty workaround.

Update 2009-11-17: A bug report has been found. Kudos to the finder varanasi.

If you are willing to dig deeper, here is another suggestion: See if you on your Samba server the filesystems are mounted with noatime or relatime. This might be related. And I'd love to hear whether this is the case at your server.

2
  • Command line works exactly like you described. I don't want to use noperm, noatime or relatime.
    – amorfis
    Oct 26, 2009 at 21:49
  • I can understand. As I said, to the best of my knowledge you've hit a bug.
    – xebeche
    Oct 31, 2009 at 22:43
0

There is a difference between the file permissions users and the samba users under older versions of samba. What version of Samba are you using? How did you create your samba user account? What samba groups did you add your samba user to on the CIFS server?

Finally, when you are doing the cp -r and the Tymek directory is created, what permissions is it created with?

2
  • Samba is in version 3.3.2. I just created user on server, he doesn't belong to any specific group. Tymek directory is: drwxrwxr-x root:samba (as seen on client side) and drwxrwxr-x mamba:mamba (on server side)
    – amorfis
    Oct 6, 2009 at 21:13
  • you should add your user on the CIFS server to the samba group on the CIFS server. That will probably do it.
    – Zak
    Oct 7, 2009 at 6:44
0

Is it a specific requirement to do this in Nautilus? If not, why not use RSync instead? I find it more reliable than cp for this sort of job.

0

When you mount the CIFS mount, its mounted with the permissions of the account you used to mount with.

That means that the permissions are from the server and not local ones.

The account you mount with should be added on the server side to the group samba.

Setting uid= and gid= in fstab or at mount time will not override server side permissions with local permission.

2
  • account I mount with is added to group sambashare. There is no "samba" group on server.
    – amorfis
    Oct 6, 2009 at 21:05
  • On the server, login with the account name, try and create a file in the shared directory. Modify the permissions until you can and you will be able to create files on the share if you mount it with that account
    – artifex
    Oct 7, 2009 at 6:53

You must log in to answer this question.

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