[3.6.6] Windows won't let me delete files

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[3.6.6] Windows won't let me delete files

Winfried
Hello

I'm running Samba 3.6.6 on an ARM Debian appliance.

While I can successfully copy files from a Windows 7 host to Samba, Windows won't let me delete files on the Samba host: "File cannot be deleted. Please remove the write protection."

Performing this operation as Administrator makes no difference, and no information is reported in /var/log/samba/log.smbd.

Here's my very basic /etc/samba/smb.conf:
===================
[global]
workgroup = WORKGROUP
netbios name = LINUX
;Important: Otherwise, doesn't switch to Unix "nobody" -> Err 5 Access denied
security = share

log level = 2

[tmp]
path = /tmp
comment = No need for Unix/Samba passwords
readonly = no
guest ok = yes
;browseable = yes
===================

The default /etc/passwd already contains a "nobody" user, which I read is used by Samba for the guest account unless otherwise specified:
===================
# grep nobody /etc/passwd
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
===================

Finally, here's one of the files in /tmp that I wanted to delete from Windows:
===================
-rwxr--r-- 1 nobody nogroup  87723 Nov 17  2004 dummy.html*
===================

Any idea what could be causing this issue?

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: [3.6.6] Windows won't let me delete files

tejas sarade
On Wed, Nov 27, 2013 at 9:11 PM, Winfried <[hidden email]> wrote:

>
> While I can successfully copy files from a Windows 7 host to Samba,
Windows
> won't let me delete files on the Samba host: "File cannot be deleted.
Please
> remove the write protection."

It looks like the file is write protected, it means it may be currently in
use by other application either on samba server or on Windows.
Also check the windows file attributes

>
> log level = 2

Try increasing log level to 3 or 4.


> The default /etc/passwd already contains a "nobody" user, which I read is
> used by Samba for the guest account unless otherwise specified:

That is correct.

> ===================
> # grep nobody /etc/passwd
> nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
> ===================
>
> Finally, here's one of the files in /tmp that I wanted to delete from
> Windows:
> ===================
> -rwxr--r-- 1 nobody nogroup  87723 Nov 17  2004 dummy.html*
> ===================

It doesn't seem to be a problem of permission. If it were the problem of
permission windows will give the error like below.

'You need permission to perform this action'
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba
Reply | Threaded
Open this post in threaded view
|

Re: [3.6.6] Windows won't let me delete files

Winfried
Thanks Tejas. Everything's working now, although I did nothing :-/

Here's what log.smbd says when I copy then delete a file with Windows Explorer between the Windows host and the Linux box:

[2000/01/09 14:42:22.126300,  2] smbd/open.c:704(open_file)
  nobody opened file serials.txt read=Yes write=Yes (numopen=1)
[2000/01/09 14:42:33.391334,  2] smbd/close.c:696(close_normal_file)
  nobody closed file serials.txt (numopen=0) NT_STATUS_OK
[2000/01/09 14:42:55.432624,  2] smbd/open.c:704(open_file)
  nobody opened file serials.txt read=No write=No (numopen=1)
[2000/01/09 14:42:56.045912,  2] smbd/close.c:696(close_normal_file)
  nobody closed file serials.txt (numopen=1) NT_STATUS_OK

I'll increase log level to 3 if this problem occurs again.

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: [3.6.6] Windows won't let me delete files

Winfried
Found it: Samba won't let me delete any file located in a sub-directory of /tmp:

# ll /tmp/images/misc/dns.jpg
-rwxr--r-- 1 nobody nogroup 12091 Oct  6  2000 /tmp/images/misc/dns.jpg*

Here's what the log says (log level = 3):

[2000/01/10 08:12:24.606125,  2] smbd/close.c:696(close_normal_file)
  nobody closed file images/misc/dns.jpg (numopen=0) NT_STATUS_OK
[2000/01/10 08:12:24.613202,  2] smbd/open.c:704(open_file)
  nobody opened file images/misc/dns.jpg read=Yes write=No (numopen=1)
[2000/01/10 08:12:25.969014,  2] smbd/open.c:704(open_file)
  nobody opened file images/misc/dns.jpg read=No write=No (numopen=2)
[2000/01/10 08:12:25.973340,  2] smbd/close.c:696(close_normal_file)
  nobody closed file images/misc/dns.jpg (numopen=1) NT_STATUS_OK

The access rights look OK. Why won't Samba delete this file?

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: [3.6.6] Windows won't let me delete files

tejas sarade
If the error is the same as previous then I don't think it is related to
permission. Still, just to make sure check the owner of directories
recursively. May be the owner of images and misc is not the same as dns.jpg.

On Thu, Nov 28, 2013 at 10:50 PM, Winfried <[hidden email]> wrote:

>
> Found it: Samba won't let me delete any file located in a sub-directory of
> /tmp:
>
> # ll /tmp/images/misc/dns.jpg
> -rwxr--r-- 1 nobody nogroup 12091 Oct  6  2000 /tmp/images/misc/dns.jpg*
>
> Here's what the log says (log level = 3):
>
> [2000/01/10 08:12:24.606125,  2] smbd/close.c:696(close_normal_file)
>   nobody closed file images/misc/dns.jpg (numopen=0) NT_STATUS_OK
> [2000/01/10 08:12:24.613202,  2] smbd/open.c:704(open_file)
>   nobody opened file images/misc/dns.jpg read=Yes write=No (numopen=1)
> [2000/01/10 08:12:25.969014,  2] smbd/open.c:704(open_file)
>   nobody opened file images/misc/dns.jpg read=No write=No (numopen=2)
> [2000/01/10 08:12:25.973340,  2] smbd/close.c:696(close_normal_file)
>   nobody closed file images/misc/dns.jpg (numopen=1) NT_STATUS_OK
>
> The access rights look OK. Why won't Samba delete this file?
>
> Thank you.
>
>
>
> --
> View this message in context:
http://samba.2283325.n4.nabble.com/3-6-6-Windows-won-t-let-me-delete-files-tp4657141p4657214.html
> Sent from the Samba - General mailing list archive at Nabble.com.
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba
Reply | Threaded
Open this post in threaded view
|

Re: [3.6.6] Windows won't let me delete files

Winfried
If it's not related to permissions, what could it be? Is "readonly = no" enough to let users delete files?

No other application is using those files, as this is in a test lab. Besides the humongous output from "log level = 3", is there anoter tool to investigate?

FWIW:
============ smb.conf
[global]
workgroup = WORKGROUP
netbios name = LINUX
;Important: Otherwise, doesn't switch to Unix "nobody" -> Err 5 Access denied
security = share

log level = 3
;log file = /var/log/samba.log.%m

[tmp]
path = /tmp
comment = No need for Unix/Samba passwords
readonly = no
guest ok = yes
;browseable = yes

============ /tmp
# ll /tmp/
drwxr-xr-x  3 nobody nogroup 4096 Jan  9 06:46 images/

# ll /tmp/images/
drwxr-xr-x 3 nobody nogroup 4096 Jan  9 06:30 misc/

# ll /tmp/images/dns.jpg
-rwxr--r-- 1 nobody nogroup 12091 Oct  6  2000 dns.jpg*
============

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: [3.6.6] Windows won't let me delete files

Winfried
To check if this could be due to using /tmp, wich uses the Sticky bit, I created a new directory (/usr/share/samba/shared-dir) which I chmoded to nobody:nogroup, edited smb.conf and reloaded Samba:

=================
[shared-dir]
path = /usr/share/samba/shared-dir/
readonly = no
guest ok = yes
browseable = yes
=================

Next, I copied a file using Windows' explorer, but when trying to delete it, I get the same "File Access Denied".

Here's the log, including a couple of highlighted lines:
http://pastebin.com/qNeZCTk9

Could it be some bug in the ARM release of 3.6.6?

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: [3.6.6] Windows won't let me delete files

Winfried
Next step: Uninstalling Samba 3.6.6, and installing Samba4 (4.0.0beta2 is what's available from the Debian depot), with the same basic smb.conf from above:

======================= Linux
# samba -V
samba: /usr/lib/arm-linux-gnueabi/libwbclient.so.0: no version information available (required by /usr/lib/arm-linux-gnueabi/samba/libauth4.so)
Version

# /etc/init.d/samba4 start
[....] Starting Samba 4 daemon: samba/usr/sbin/samba: /usr/lib/arm-linux-gnueabi/libwbclient.so.0: no version information available (required by /usr/lib/arm-linux-gnueabi/samba/libauth4.so)
Unknown enumerated value 'share' for 'security'
. ok

# ps aux  | grep samba
root     11241  1.3  5.7  76196 29836 ?        Ss   16:27   0:02 /usr/sbin/samba -D
root     11259  0.0  3.7  76196 19064 ?        S    16:27   0:00 /usr/sbin/samba -D
root     11261  0.0  3.8  76196 19744 ?        S    16:27   0:00 /usr/sbin/samba -D
root     11262  0.0  3.9  76316 20396 ?        S    16:27   0:00 /usr/sbin/samba -D
root     11263  0.0  3.6  76196 18880 ?        S    16:27   0:00 /usr/sbin/samba -D
root     11269  0.0  3.6  76196 18988 ?        S    16:27   0:00 /usr/sbin/samba -D
root     11271  0.0  3.6  76196 18880 ?        S    16:27   0:00 /usr/sbin/samba -D
=======================

======================= Windows
C:\Users\joe>net view
System error 53 has occurred.

The network path was not found.
=======================
Reply | Threaded
Open this post in threaded view
|

Re: [3.6.6] Windows won't let me delete files

tejas sarade
Becauser samba 4 server doesn't support security = share. Evern with the
version 3.6.6 it is already deprecated.
Set
security = user



On Fri, Nov 29, 2013 at 6:59 AM, Winfried <[hidden email]> wrote:

> Next step: Uninstalling Samba 3.6.6, and installing Samba4 (4.0.0beta2 is
> what's available from the Debian depot), with the same basic smb.conf from
> above:
>
> ======================= Linux
> # samba -V
> samba: /usr/lib/arm-linux-gnueabi/libwbclient.so.0: no version information
> available (required by /usr/lib/arm-linux-gnueabi/samba/libauth4.so)
> Version
>
> # /etc/init.d/samba4 start
> [....] Starting Samba 4 daemon: samba/usr/sbin/samba:
> /usr/lib/arm-linux-gnueabi/libwbclient.so.0: no version information
> available (required by /usr/lib/arm-linux-gnueabi/samba/libauth4.so)
> Unknown enumerated value 'share' for 'security'
> . ok
>
> # ps aux  | grep samba
> root     11241  1.3  5.7  76196 29836 ?        Ss   16:27   0:02
> /usr/sbin/samba -D
> root     11259  0.0  3.7  76196 19064 ?        S    16:27   0:00
> /usr/sbin/samba -D
> root     11261  0.0  3.8  76196 19744 ?        S    16:27   0:00
> /usr/sbin/samba -D
> root     11262  0.0  3.9  76316 20396 ?        S    16:27   0:00
> /usr/sbin/samba -D
> root     11263  0.0  3.6  76196 18880 ?        S    16:27   0:00
> /usr/sbin/samba -D
> root     11269  0.0  3.6  76196 18988 ?        S    16:27   0:00
> /usr/sbin/samba -D
> root     11271  0.0  3.6  76196 18880 ?        S    16:27   0:00
> /usr/sbin/samba -D
> =======================
>
> ======================= Windows
> C:\Users\joe>net view
> System error 53 has occurred.
>
> The network path was not found.
> =======================
>
>
>
> --
> View this message in context:
> http://samba.2283325.n4.nabble.com/3-6-6-Windows-won-t-let-me-delete-files-tp4657141p4657247.html
> Sent from the Samba - General mailing list archive at Nabble.com.
> --
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba
>
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba
Reply | Threaded
Open this post in threaded view
|

Re: [3.6.6] Windows won't let me delete files

Winfried
I favor using "security=share" instead of "security=user" because the former doesn't require creating a user account with smbpasswd and prompting users for a user/password when accessing the share.

But since Samba4 is a whole lot bigger and more complicated, I uninstalled and went back to 3.6.6.

As Google showed other people were having the same issue with Windows7 (ie. Samba would let them copy files from Windows to Samba, but they would get a "File Access Denied" when trying to delete the files afterward), I performed the same task from an XPSP3 host... but get the same result: "Access denied".

=> However, I noticed this occurs for directories, while I can create/modify/delete a single file. So this issue looks specific to directories.

So I switched from "security=share" to "security=user", used "smbpasswd -a nobody" to add that default Unix account to the Samba security database, and I can finally delete directories, although "net view" triggers "Access denied" unless the user previously authenticated:

==================
C:\Users\fred>net view \\linux
System error 5 has occurred.

Access is denied.
==================
C:\Users\fred>net use \\linux\ipc$ /user:nobody
The password or user name is invalid for \\linux\ipc$.

Enter the password for 'nobody' to connect to 'linux':
The command completed successfully.
==================
C:\Users\fred>net view \\linux
Shared resources at \\linux

Samba 3.6.6

Share name  Type  Used as  Comment

---------------------------------------------------------------------
tmp         Disk           No need for Unix/Samba passwords
The command completed successfully.
==================
C:\Users\fred>net use z: \\linux\tmp

The command completed successfully.
==================

Bottom line with "security=share":
1. It has the advantage of not prompting the user for a user/password
2. It allows users to delete files, but not directories... but if users can create/modify files through "security=share", logically, they should also be able to delete directories they created.

It looks like some Samba/Windows compatibility issue.

So... does Samba support fully sharing (create/modify/delete) files + directories without prompting users for a user/password, à la anonymous FTP?

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: [3.6.6] Windows won't let me delete files

Winfried
Yes, the issue is specific to directories:
- I can not delete any file within a directory
- I can copy a file from the root of the share into a directory, but I cannot delete/move it once it's been copied into a directory.
Reply | Threaded
Open this post in threaded view
|

Re: [3.6.6] Windows won't let me delete files

Winfried
This post has NOT been accepted by the mailing list yet.
I wonder if it's due to the way Windows handles access rights.

Here's what it says when right-clicking on a a file which I successfully copied from Windows but am then unable to delete:

http://postimg.org/image/def0v0hkb/
http://postimg.org/image/6f22efhb9/
Reply | Threaded
Open this post in threaded view
|

Re: [3.6.6] Windows won't let me delete files

Winfried
Problem solved: All it took is replacing "security=share" with the following:

security = user
;will map user to "nobody"
map to guest = Bad User

Just like with "security=share", the user won't be prompted by a login/passwd, but this time, will be allowed to rename/delete files and directories.

Thanks everyone for the help.