renaming via samba changes file permissions

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
jrbrown00
Junior Member
Junior Member
Posts: 26
Joined: 2003-04-23, 15:49 UTC

renaming via samba changes file permissions

Post by *jrbrown00 »

I use Samba to map UNIX (Solaris) drives to Windows. When I rename a file from windows, it changes the file permissions. In my test, i renamed an empty file named 'core' to 'core.renamed' and the permissions changed from 600 rw- --- --- to 720 rwx -w- ---.


Why? How do I control this?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48108
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Renaming doesn't usually change any permissions.

I can only guess that Samba prohibited the renaming, so TC copied the file to the new name and then deleted the original. Can you confirm this? You can check this by renaming a large file, you would get a progress bar then for the copied data.
Author of Total Commander
https://www.ghisler.com
User avatar
frenky
Senior Member
Senior Member
Posts: 250
Joined: 2005-07-30, 19:36 UTC

Post by *frenky »

ghisler(Author) wrote:Renaming doesn't usually change any permissions.

I can only guess that Samba prohibited the renaming, so TC copied the file to the new name and then deleted the original. Can you confirm this? You can check this by renaming a large file, you would get a progress bar then for the copied data.
I do not like for this to be executed without any dialog informing about concequences...
Ambiguity succeeds where honesty dares not venture.
jrbrown00
Junior Member
Junior Member
Posts: 26
Joined: 2003-04-23, 15:49 UTC

Post by *jrbrown00 »

Rename from explorer works correctly and does not change permissions. Using Total Commander 6.53, a 56 meg file was renamed amost instantly, so it does not appear to be copying the file. File permissions were changed from 644 to 764

-rw-r--r-- 1 jbr3e meme 56901632 Jul 20 09:06 k_sto_combo.sas7bdat

to

-rwxrw-r-- 1 jbr3e meme 56901632 Jul 20 09:06 k_sto_combo.sas7bdat.rename*

Previously the file permissions were changed from 600 rw- --- --- to 720 rwx -w- ---. so it seems that 120 (--x -w- ---) is being added


my umask is 022
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48108
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

OK I checked what TC does exactly:
1. Read the attribute of the file
2. If it has read only, hidden, or system set, reset to archive only. This is done because some network file systems seem to prevent the renaming with these attributes.
3. Rename the file
4. Set the attribute back to what it was in step 1, including the archive bit

I guess that Samba is trying to map this to Unix permissions in some weird way, causing the change of the permissons in your case. Unfortunately I have no influence on how Samba handles calls to Windows attribute changes. Maybe it can be controlled in the samba settings.
Author of Total Commander
https://www.ghisler.com
jrbrown00
Junior Member
Junior Member
Posts: 26
Joined: 2003-04-23, 15:49 UTC

renaming via samba changes file permissions

Post by *jrbrown00 »

I'm confused then. Why does the explorere rename work correctly and TC not work correctly?
jrbrown00
Junior Member
Junior Member
Posts: 26
Joined: 2003-04-23, 15:49 UTC

Post by *jrbrown00 »

UNIX file permissions are 9 characters (bits, whatever ...) and must be mapped to windows attributes Read-Only,System, Hidden, and Archive.

How is this mapping accomplished? Does TC's method hook in at the same place as does Samba? I may not even be asking this correctly.
User avatar
Hacker
Moderator
Moderator
Posts: 13073
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

UNIX file permissions are 9 characters (bits, whatever ...) and must be mapped to windows attributes Read-Only,System, Hidden, and Archive.
Ahem, I wouldn't be so convinced of that.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
jrbrown00
Junior Member
Junior Member
Posts: 26
Joined: 2003-04-23, 15:49 UTC

renaming via samba changes file permissions

Post by *jrbrown00 »

I am quite willing to be convinced otherwise, but it seems to me that the problem arises when permissions are changed and then reset in step 4 (from above by ghisler). 120 (--x -w- ---) is consistently or'ed onto the existing attributes. My thoughts: From a 'file only' perspective, Windows has no concept of execute permissions, so the first --x is set. Windows also does not know about group permissions so group write access is apparently set to the same as user permissions. I don't know why group execute permissions are not set.

I just want TC to behave the same way as does Windows Explorer. Is that possible? I use TC all of the time, but this is a major pain when talking to UNIX.
Post Reply