in order to debug this i have given my linux samba share full permissions (777). from a windows machine i have no problems browsing the samba share and opening files. the problem is that i cannot save any new files or existing files.

i may be missing something in my smb.conf which i attached. i also attached the log file. the lines from March 19 are the pertinent ones.

i really can't understand the log file... looks like its losing connection when trying to write... anyone have any ideas why this is happening?? thanks!

jschiwal

03-19-2008 11:44 AM

What are the permissions and the ownership of the directory being shared?

For a public writable service, the directory should have the same permissions as the /tmp directory,
sudo chmod a=rwxt <directory> will fix the problem.

However, the share is in /media/ which makes me wonder what kind of filesystem is on it and whether this is a removable drive.

If the user has an account in samba, you should use the "smbpasswd" program to add the user & password to samba's /etc/samba/smbpasswd file, which serves a similar function as Linux's /etc/passwd & /etc/shadow files. Ideally you want to keep the usernames & passwords identical for Linux & Windows users.

If this is a public share that any user can access, make sure to use the "map to guest = bad user" option in the share definition or the [global] definition. This will give unknown users the username of nobody.

Good Luck!

lrt

03-19-2008 12:20 PM

i'm using ubuntu distro which has a /media directory for mounting instead of /mnt. the folder/subfolders/files i am trying to share are actually mounted from a network attached storage.

Quote:

If the user has an account in samba, you should use the "smbpasswd" program to add the user & password to samba's /etc/samba/smbpasswd file, which serves a similar function as Linux's /etc/passwd & /etc/shadow files. Ideally you want to keep the usernames & passwords identical for Linux & Windows users.

i've already have this configured...

i need to know why the i can't save new or existing files... all folders and files have full permission chmod a=rwx

jschiwal

03-19-2008 08:52 PM

I noticed a typo in my previous message. I was suggesting rwx permission for everyone and setting the sticky bit. "sudo chmod a=rwxt <directory>". The sticky bit will prevent one user from deleting another users files. This will work for users who are valid samba users.

I don't know if you can share a subdirectory of a shared service this way in samba. I'm not certain, but it may fail if you use smbfs but be successful if you use cifs.

How is /media/daneel/ mounted on the server. Is is mounted in /etc/fstab or automounted from the desktop? Did you use the smbfs or cifs filesytem. Or is it an nfs service? Does the "chmod a=rwxt" command change the permissions of /media/daneel/A-F/a-f?

Also, the smb.conf segments you posted don't have any glaring errors that I noticed so I don't think that is the problem. Check the output of "mount" on the server. Note how /media/daneel is mounted. Also, what file system does the NAS system use. If it uses a Linux based filesystem, and you mount the share on the NAS using the CIFS file system, then you may be able to offer the /media/daneel/A-F/a-f directory as a service. Cifs has extended unix to unix support so it is more like using nfs to a Linux user than a share mounted using smbfs.

My concern about /media is that the HAL/UDEV/Desktop system automatically creates and destroys directories there. A better place for a globally accessible file share would be under /srv/samba/.

---

My main concern with this new information is to look at the /media/daneel service first. If the NAS device is using a Windows filesystem or doesn't support CIFS, that could be the source of the problem.

If on the other hand it uses a Linux native filesytem but you are mounting it using the smbfs filesystem type, changing how the NAS service is mounted may resolve the problem.

---

What is the source of this log file? Is it on a client computer or the server? If it is from the server, I think it is the NAS that is reseting the connection (the peer):

While rwilliams may be a valid user on the server, is he a valid user on the NAS?

lrt

03-20-2008 09:29 AM

thanks for your help on this... i have figured out what the problem is, but i will attempt to answer all your questions nevertheless...

Quote:

I don't know if you can share a subdirectory of a shared service this way in samba. I'm not certain, but it may fail if you use smbfs but be successful if you use cifs.

i am using cifs and so far i don't see a problem sharing a directory that is already mounted from a NAS. the NAS is mounted with cifs and shared to my clients with samba.

Quote:

How is /media/daneel/ mounted on the server. Is is mounted in /etc/fstab or automounted from the desktop? Did you use the smbfs or cifs filesytem. Or is it an nfs service? Does the "chmod a=rwxt" command change the permissions of /media/daneel/A-F/a-f?

/media/daneel is mounted with /etc/fstab. i used cifs. i have to mount the share while specifying the permissions at the same time. i had to use the file_mode and dir_mode options in /etc/fstab to do this. :)

Quote:

My concern about /media is that the HAL/UDEV/Desktop system automatically creates and destroys directories there. A better place for a globally accessible file share would be under /srv/samba/.

i have no idea what you're talking about but i will do look into this.

Quote:

My main concern with this new information is to look at the /media/daneel service first. If the NAS device is using a Windows filesystem or doesn't support CIFS, that could be the source of the problem.

this is not a concern.

Quote:

What is the source of this log file? Is it on a client computer or the server? If it is from the server, I think it is the NAS that is reseting the connection (the peer):

the log file is a server log created with the log file option in smb.conf

Code:

log file = /var/log/samba/log.%m

Quote:

is rwilliams a client on another computer or on the server or both?

rwilliams is a client user and has a samba account in addition to the required server account (this is what samba requires if i'm not mistaken).

now let me recap what my problem was. basically i would map a network drive in windows to connect to the /media/daneel share. the connection was successful and i could fully browse the entire directory, subdirectories and files without a problem. i was also able to open any file for reading. the PROBLEM was that i could not save new or existing files, i had no write permissions. this was odd for me because the permissions i had for rwilliams and all other users within that group (group permission) was read/write.

the permissions i have for all files in the /media/daneel/ directory is 0764. owner is root (full permissions), group is read/write, and others are read. when i map the network drive on the xp client and i right-click view properties, and view the permissions, i can see that these permissions are mapped beautifully. the group (which i called 'editors') has only read and write checked of. the root user has the full access checkbox checked of, and the "Everyone" user has on the read checkbox checked of. but, i still COULD NOT save new or existing files.

so i did some deep searching on google and found that i needed this option in smb.conf

Code:

inherit permissions = yes

the default is 'no', so i had to specify 'yes'. this allowed me to save new and existing files without a problem. if you read the smb.conf man page it will tell you that newly created files will inherit permissions from parent when this is set to 'yes'. i may be mistaken but when you make changes to an existing file and then save, you are essentially creating a new file. this newly created file should be created with its parent permission (the permissions i set for the entire directory when i mounted it from the NAS).

this has fixed my problem, but i am going to test this some more to make sure i didn't miss anything... thanks for your help!!!

biasakhu

04-06-2008 08:39 AM

no write permissions on samba share with Vista

I was having a very similar problem with Windows Vista mapping a network drive, and I had my Samba configuration perfect as far as I could tell from this and other posts. However, unlike with XP, Vista was giving me problems with UAC in opening up the network drive. Resetting the attributes for the directory in Windows finally gave me the write privileges even though everything was correct in Linux!