jborean93 / smbprotocol

Python SMBv2 and v3 Client
MIT License
318 stars 73 forks source link

Can't delete files owned by other users #155

Closed Alexinio97 closed 2 years ago

Alexinio97 commented 2 years ago

I have a shared folder configured on linux and I stumbled upon a problem when I try to remove a file that has another user ( other user than the one that owns the shared folder). On linux I can remove it with the force argument ( rm -f file), is it possible to send this argument to the remove method from smbprotocol? Is there another way to handle this situation, we want to be able to have full control over all the files in that shared folder even if they are owned by other users. We get SMBOSError when we try to remove a file that doesn't belong to the share user with the message: STATUS_ACCESS_DENIED. This is the method that we are using https://github.com/jborean93/smbprotocol/blob/master/smbclient/_os.py#L424

jborean93 commented 2 years ago

smbclient is dependent on whatever rights your connecting user has on the target filesystem. It's up the server to validate whether it can perform the action or not. There are no shell mechanisms to send command like rm -f file over SMB so you are at the mercy of the actual file system operation and how the server interprets that.

Alexinio97 commented 2 years ago

Thank you for your response, I will close this!