# Permission denied on Samba share



## paleksic (Mar 10, 2009)

I have a samba server setup locally and I can connect to the specified shared home drive on the FreeBSD Server from the Linux and Windows machines. 

I can delete, save or create only single files and folders but when i try to copy, move folders I get an "Permission Denied" error message.

Everything appears to be correct to allow full access to users so I dont know what is happening. Anyone got any advice?

Thanks


```
paleksic@overlord ~ 0 $ sudo mount -t cifs //192.168.1.3/Unix /mnt/samba -o username=paleksic,password=xxxxxxxx,uid=paleksic,gid=users,rw,iocharset=utf8,file_mode=0777,dir_mode=0777
paleksic@overlord ~ 0 $ cd /mnt/samba/
paleksic@overlord samba 0 $ mkdir test
paleksic@overlord samba 0 $ cd test/
paleksic@overlord test 0 $ touch 1 2 3
paleksic@overlord test 0 $ ll
-rw-r--r-- 1 paleksic users 0 2009-03-10 12:20 1
-rw-r--r-- 1 paleksic users 0 2009-03-10 12:20 2
-rw-r--r-- 1 paleksic users 0 2009-03-10 12:20 3
paleksic@overlord samba 130 $ cp -R /home/paleksic/documents/multimedia/Video/divx/Futurama.Benders.Game.2008.DVDRip.XviD-DOMiNO .
cp: cannot create regular file `./Futurama.Benders.Game.2008.DVDRip.XviD-DOMiNO/domino-futuramabg.avi': Permission denied
cp: cannot create regular file `./Futurama.Benders.Game.2008.DVDRip.XviD-DOMiNO/domino-futuramabg.srt': Permission denied
```



```
[ ] LDAP         With LDAP support  
[ ] ADS          With Active Directory support                
[ ] CUPS         With CUPS printing support                   
[X] WINBIND      With WinBIND support 
[ ] SWAT         With SWAT
[ ] ACL_SUPPORT  With ACL support                     
[ ] AIO_SUPPORT  With Asyncronous IO support           
[ ] FAM_SUPPORT  With File Alteration Monitor              
[X] SYSLOG       With Syslog support                          
[ ] QUOTAS       With Disk quota support                      
[X] UTMP         With UTMP accounting support 
[ ] PAM_SMBPASS  With PAM authentication vs passdb backends
[ ] DNSUPDATE    With dynamic DNS update(require ADS)        
[ ] DNSSD        With DNS service discovery support           
[ ] EXP_MODULES  With experimental modules
```



```
[root@medved ~]# cat /usr/local/etc/smb.conf
[global]                                    
   workgroup = OVERLORDW                    
   server string = FreeBSD Server
   encrypt passwords = yes
   security = user
   load printers = no
;   max log size = 100
   interfaces = 192.168.2.1 192.168.1.3
   local master = yes
   os level = 99
   domain master = no
   preferred master = no
   dns proxy = no
;  disable netbios = yes


[Unix]
   comment = Unix Share Folder
   path = /home/paleksic/samba
   valid users = paleksic
   public = no
   guest ok = no
   browseable = yes
   writable = yes
   printable = no
```


```
[root@medved /var/log/samba]# tail -n 7 log.smbd
[2009/03/10 12:17:46,  1] smbd/service.c:make_connection_snum(1103)
  192.168.2.250 (192.168.2.250) connect to service Unix initially as user paleksic (uid=1002, gid=1002) (pid 59611)
[2009/03/10 12:17:46,  1] smbd/service.c:close_cnum(1315)
  192.168.2.250 (192.168.2.250) closed connection to service Unix
[2009/03/10 12:18:30,  1] smbd/service.c:make_connection_snum(1103)
  192.168.2.250 (192.168.2.250) connect to service Unix initially as user paleksic (uid=1002, gid=1002) (pid 59612)
```


----------



## pamdirac (Mar 10, 2009)

the permission of /home/paleksic/samba ???


----------



## paleksic (Mar 10, 2009)

Permissions appears to be correct to allow full access to user


```
paleksic@overlord mnt 0 $ id
uid=1000(paleksic) gid=100(users) groups=10(wheel),33(http),81(dbus),82(hal),91(video),92(audio),93(optical),95(storage),98(power),100(users),503(fuse),504(paleksic)
paleksic@overlord mnt 0 $ ls -ld /mnt/samba/
drwxr-xr-x 3 paleksic users 0 2009-03-10 14:14 /mnt/samba/
paleksic@overlord mnt 0 $ mount | grep samba
//192.168.1.3/Unix on /mnt/samba type cifs (rw,mand)
```


:q how is this even possible

```
paleksic@overlord mnt 0 $ cp -R /home/paleksic/Desktop/Downloads/screenshots samba/
cp: cannot create regular file `samba/screenshots/snapshot1.png': Permission denied
cp: cannot create regular file `samba/screenshots/snapshot2.png': Permission denied
paleksic@overlord mnt 1 $ cp -R /home/paleksic/Desktop/Downloads/screenshots samba/
paleksic@overlord mnt 0 $
```


----------



## paleksic (Mar 10, 2009)

*Solved*

The UID and GID of the users do not match on the server and client, so user have no proper rights to files in mounted shares on his local machine. I changed UID/GID's in the Linux box to bring them in sync with FreeBSD and as a result I can write to the share.


----------



## codywohlers (Aug 18, 2009)

*noperm option*



			
				paleksic said:
			
		

> :q how is this even possible



I had the same problem and I just mounted with the share with the noperm option as per the mount.cifs man page. (instead of matching UIDs on the client/server)


----------

