简体   繁体   中英

Remotely Changing permissions of file pushed to W7 machine using smbclient

I have a file that I want to transfer to a remote machine that is running W7 32 bit

I have a script that enables me to push the file to the machine from a linux management server, using a combination of:

1) smbclient to mount the Admin share on the W7 machine 2) winexe to move the file to the location I require

This leaves me with the file in the correct location, but owned by the Admin user - whereas I need it to be editable by a standard user, User1

I have been trying to resolve this by using icacls Using winexe I can run this remotely on the W7 machine. Initially I tried setting the poermissions to "Full" for the user account:

icacls c:......\\myFile /grant User1:F

Checking this from the command line showed that it had apparently worked: icacls c:......\\myFile c:......\\myFile User1:(F)

However, from the windoes desktop, the file properties dialogue showed User1 having only read permissions, and anything else gave access denied.

My next attempt was:

icacls c:......\\myFile /setowner User1

However, when logged in to the windows desktop as User1, attempting to delete or edit the file now tells me that doing so requires permission from User1....which is a bit peverse, since I am logged in as User1....

Any ideas?

This may or may not help, but I was unable to delete a file I copied from a Linux machine to a Windows shared folder - was getting a 'need Administrator permission' type error.

I was trying to solve this with the smbclient -c "setmode -r;" option, but when this didn't work I realised the Windows folder itself was set for read-only access for all but Administrator level.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM