# Something Samba - can't rename random folders.



## niellusNL (Jan 20, 2012)

Hi everyone,

First of all, I am new to the forums so I would like to say hello! My name is Niels and I am from the Netherlands. Currently I am learning FreeBSD as my first *NIX type of OS. The reason I went for FreeBSD is pretty simple; the book I got is great to read (No Starch Press - Absolute FreeBSD)!! Oh, and ZFS seemed so much easier to learn than LVM (I want a scalable storage pool)  

I have practised for a while now and made the BIG step to buy a new computer case to build in some left over parts en create my own server. My skill in FreeBSD is still pretty low though.

Now that I have my own dedicated home server I want to install stuff onto it. So here is what I got:


```
uname -a
FreeBSD area50 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:46:30 UTC 2012     
root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
```

I have a user account, _userx_, who is a member of the _userx, wheel and samba_ groups.

In my server I use 2x 1tb hdd in a ZFS mirror pool mounted as /zdata. Also, I use 2x 2tb in a ZFS "straight" pool, mounted as /ztank.

These mounts both belong to _userx:samba_. Access rights are: u=rwx, g=rwx, o=[none]. So as far as I can work out I can do anything in these folders with my _userx_ account, as well as with any account that is a member of the _samba_ group.

I set up Samba (version 3.6 from ports) as follows:


```
[global]
workgroup = WORKGROUP
netbios name = AREA50
security = share
guest account = [I]userx[/I]
local master = yes
os level = 35

[Data]
path = /zdata
guest ok = yes
writable = yes
create mask = 760
directory mask = 770

[Tank]
path = /ztank
guest ok = yes
writable = yes
create mask = 760
directory mask = 770
```

This seems to work, I can just browse from any PC on the network and write/delete/modify file on the Samba server. I am happy! - files created from windows workstations get -rwxrw---- and dirs get drwxrwx---. Just as I wanted, I am more happy!

Then the next hurdle, install sabnzbd+. After some experimenting I got that to work the way I wanted also.. great. The install made a user __sabnzbd_ and group __sabnzbd_. I decided in the sabnzbd.ini that it should run as __sabnzbd_ and group _samba_. I reasoned that __sabnzbd_ had to be member of the _samba_ group, so that I could point sabnzbd to download and extract to any of the ZFS shares.

So now I have:
Group _samba_ with members _userx,_sabnzbd_.

I can also download, repair and extract with sabnzbd+ with no problems at all. I configured it to maintain the rwxrwx--- and rwxrw---- permissions.

But now comes the tricky bit. When it's finished downloading, I move my files to another folder. I also wish to rename the downloaded stuff, so I can keep a clean library. The downloads go to /ztank/Downloads.

The moving of the files and folders seems really inconsistent. Some folders I can move to their final directory (usually from /zdata/Downloads to /zdata/Video/Films). And some I can't. This goes for the renaming and deleting also.

The things I have tried:
- double check all groups and permissions, also used by Samba and Sabnzbd;
- restarting, stopping the samba and sabnzbd  in several combinations to see whether either on had files locked;
- change network cable;
- install Ubuntu in a virtualbox and see if that gave any problems;
- chown all to _userx:userx_;
- chown all to _userx:samba_;
- Google searches;
- Play with oplocks in Samba;

Nothing seemed to work!

I even thought about quitting the whole Samba thing and use FTP, but that would kind of feel like losing 

I really hope someone can help me out or point me in the right direction because I'm starting to run empty on ideas. I've been struggling for over 5 hours straight am starting to get kind of fed up now (and with Samba as a whole for a week).


----------



## niellusNL (Jan 20, 2012)

Sorry, I forgot to add that the error I am getting when I try to modify the files and folders is something like 
	
	



```
cannot move folder because it is already opened by another program
```
 It's the error I am getting from my Windows machine.


----------



## niellusNL (Nov 1, 2012)

I know this post is rather old now, but I have solved all my Samba problems. I can't remember how I solved this particular problem but I still want to share a few things that I learned while playing with Samba, hoping other people might be helped:

- In the Samba rc script I entered a delay of 10 seconds. I don't know the exact reason but iirc somewhere I read that some network cards need a little bit of "warmup time". This prevents me from having to restart the Samba service manually, right after a reboot, in order to get Samba to work properly.

- Take parent folder permissions in consideration. These might prevent reading/writing in or to a child folder. Even though the permissions in the child folder seem right.

Hopefully these points prove useful on other people's checklists (


----------

