On 01/03/2023 20:45, Jeffrey Johnson via samba wrote:> A user is attempting to use Windows Powershell get-childitem command to
> copy files from one SMB directory to another.
>
> *****************
> Get-ChildItem -Path "W:\z_TestFiles\source1" -Recurse -File |
> ForEach-Object {
> Copy-Item -Path $_.FullName -Destination "X:\dest1"
> }
> *****************
>
> When the command is run it creates the files as 0 byte files and then
> errors.
>
> *****************
> Copy-Item : Element not found.
> At line:2 char:5
> + Copy-Item -Path $_.FullName -Destination "X:\dest1 ...
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + CategoryInfo : NotSpecified: (:) [Copy-Item], IOException
> + FullyQualifiedErrorId :
> System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand
> *****************
>
> When I look at the zero byte files in Unix
> drwxrwxr-x 2 ourapp digicol 6 Mar 1 14:02 .
> drwxrwx--- 8 user digicol 11 Mar 1 14:02 ..
> -rwxrw-r-- 1 ourapp digicol 0 Mar 1 14:03 2022-02-15
> 12_49_46-TeraCopy.jpg
>
> When I set the owner of the directory to the user. This works fine.
> drwxrwxr-x 2 user digicol 6 Mar 1 14:02 .
> drwxrwx--- 8 user digicol 11 Mar 1 14:02 ..
> -rwxrw-r-- 1 user digicol 14321 Mar 1 14:03 2022-02-15
> 12_49_46-TeraCopy.jpg
>
> Cutting and pasting using Windows Explorer and Teracopy, usually but not
> every time, works properly. I haven't figured out what causes this
to
> work sometimes and not others.
>
> From what I have seen the problem is the inheriting of the owner, which is
> necessary for our application and outside of my control.
>
> In our smb.conf file
> [global]
> allow insecure wide links = yes
> unix extensions = no
> log level = 1
> load printers = no
> printing = bsd
> printcap name = /dev/null
> disable spoolss = yes
> min protocol = SMB2
> workgroup = MYGROUP
> server role = standalone server
>
> [application]
> path = /application
> comment = Application Shared Folder
> follow symlinks = yes
> wide links = yes
> writable = yes
> inherit permissions = yes
> inherit owner = yes
> inherit acls = yes
> valid users = @application
>
>
> Solaris 11.4
> Samba 4.13.17
>
> In advice on what I need to look at to make this behave properly.
>
Set the correct permissions ;-)
Your user is connecting to the '..' directory and is allowed access to
the '.' directory
it now gets access to the '.' directory via others but doesn't have
write access.
Basically the user needs to traverse the entire path and have write
access on the finally directory
Rowland