Robert Baer <
robertbaer@localnet.com> wrote:
VanguardLH wrote:
Robert Baer <robertbaer@localnet.com> wrote:
Properties of file has ReadOnly checked; a Directory does NOT show
the attribute. And..any program can write to it...
Just stumbled into this. So what good are attribute (bits) if
ignored?
Attributes for files do not have the same definitions as attributions
for folders. What you guessed regarding attributes is wrong, but a
lot of users don't know, too.
https://support.microsoft.com/en-us/topic/you-cannot-view-or-change-the-read-only-or-the-system-attributes-of-folders-in-windows-server-2003-in-windows-xp-in-windows-vista-or-in-windows-7-55bd5ec5-d19e-6173-0df1-8f5b49247165
Any process can change file or folder attributes. It is not an
effective protection. You changed it. So can anything else. If
you want to block access to a file, look into permissions.
Right-click on a file or folder in Windows/File Explorer, select
Properties, and go to the Security tab. Permissions is a big topic,
so I'll just refer you to online searches to learn. Only NTFS has
permissions. FAT does not. You must have admin privileges in the
Windows account under which you login to change permissions.
Tried, Win 7.1 only.
Article empfASSizes folders and almost totally ignores files.
As mentioned, enabling the read-only attribute on a file can be
trivially disabled. You can change the read-only attribute, so can the
attrib program, so can any software.
I've seen this for a long time, especially with games. I make a file
read-only because I don't want the game to change my user config. I
load a new mission, its author decided to change the config (because
they wanted a different load screen or other behaviors changed in the
mission), and I find the read-only file is no longer read-only and was modified.
The read-only attribute hails from the MS/IBM-DOS era. It was never a
secure nor reliable means of blocking access to a file. After all, you
changed the attribute, so why can't anything else running under that
same Windows account do the same as yourself?
I clicked on properties of a file, checked the Read Only box, and
found two crappy results: 1) a directory showed no change
Read-only attribute on a file is not mirrored to the directory. Nor
should it be.
2) the file itself was easily writable
Was that while you were still writing the file? Or after you were done
making changes (there were some, right?), and tried to save the file
(without specifying a new filename or different location)?
If the editor doesn't honor file attributes, it will change them to
however they want. It's software, too, just like software you used to enable/disable those attributes. If the editor does honor the file
attributes, like read-only, it will NOT alert you when you open the
file, because the file has not yet been saved in the file system to
replace the original one. It should alert you when you exit the editor
and attempt to save changes. With read-only file, an obedient editor
should tell you that you cannot overwrite the existing file, and you'll
need to save the modified copy to elsewhere.
Has this BS been around since 3.1 like Paul as implied?
The file attributes (read, hidden, system, archive) have been around
since the DOS days.
Now, if one uses the command prompt, one CAN set +R with the attrib
command. BUT....a DIRectory refuses to show that.
Are you using attrib on a file or directory, and then looking at
attributes on the directory? As noted, changing attributes on a file is
not reflected to the directory. Decide WHERE you want the attribute
changed. Also noted the attributes for files do NOT mean the same thing
for directories.
If you are attempting to secure access to file, stop using file
attributes. Use NTFS as the file system, and use permissions on the
file. Permissions work at both the folder and file level. You can
start here, and your library may even have a copy:
https://www.dummies.com/computers/operating-systems/windows-10/how-do-permissions-work-in-windows-10/
and lots more help at:
https://www.google.com/search?q=NTFS%20file%20permissions
However, understand if you are granted permissions to a file then so,
too, is every program you run under that same Windows account. An OS
cannot differentiate between you and a process accessing a file. After
all, you are not accessing any files. You use a process for that, like
an editor.
--- Synchronet 3.20a-Win32 NewsLink 1.114