File Names, Extensions, Properties and Security

Before you start

Objectives: learn important file extensions, how file associations are made, what different file attributes exist, how to hide or compress and encrypt a file, what are file permissions, how to show protected system files and why is NTFS important.

Prerequisites: no prerequisites.

Key terms: ntfs, attribute, hidden, compressed, control, encrypt, permissions, explorer, folder, protected


File Names

In the days of the DOS and Windows 3X versions of Windows which used FAT16 file system, we had to follow the 8.3 naming convention. 8.3 naming convention means that we can use 8 characters maximum in the file name (the part before the period), and three characters maximum in the extension (the part after the period). The file name could not include spaces and could not include special characters. With FAT32 and NTFS we now have long file name support which means that we can use up to 255 characters in file name. NTFS supports Unicode characters which means that it supports all characters except of /.

File Extensions

A complete file name is made up of a file path combined with the name of the file itself. Extensions are included in a file name to indicate a file type. The extension identifies what the file it is, what it contains and what program is used to create and modify the file. There are many kinds of file extensions today. Three specific extensions are .com, .exe and .bat. COM stands for command or compiled file, EXE stands for executable file, and BAT stands for batch file. Files with those extensions will execute some code when we run them and they will do something. Batch files also run and execute a series of commands, but typically launch another program to interpret the commands in the batch or script file.

Other types of files that won’t execute, but are part of a program are .dll,.drv, and .vxd. DLL stands for data link library, DRV stands for driver, and VXD stands for virtual device driver. A dll is part of a Windows program, a drvis a driver used by an application to talk to hardware and vxd is a virtual device driver.

Other file extensions that don’t execute and are not part of any program are, for example, .txt, .docx or .doc, .rtf, .pdf, .xls or .xlsx,  .ppt or.pptx, etcetera. A text file TXT is alpha numeric text. RTF is rich text format which is an enhancement of .txt. A DOC and DOCX is a Word file. PDF is Adobe’s portable document format. Common image extensions are .gif,  .jpg, .bmp, and .png. JPG a compressed image. BMP is a Windows bitmap. PNG is a portable network graphic. Common compressed audio formats are.mp3 and .wma. Windows installer files are .msi and .zap.

To check the file extension we can right click a file and choose Properties.

 File Properties

331.1 – File Properties

Notice that in our case the type of file is JPEG image (.jpg). In this tab we can also see the file name and the program that opens this type of file. In our case .jpg files are opened with Windows Photo Viewer. We can also see the location for the file as well as the size of the file and when it was created and last modified.

There is a way in which we can show the file extension along with the file name. We can change this by going to the Control Panel > Folder Options > View tab. Here we have an option ‘Hide extensions for known file types’.

 Extension Options

331.2 – Extension Option

By default, Windows hides the extension of files. If we uncheck this, the file extension will be added to the file names in Windows Explorer.

File Associations

Microsoft Windows associates files with applications by their extension. A .docx file opens in Word, a .png opens in image viewing program, .mp3 opens in audio player, and so on. We can change the extensions association within Windows but if a file is incorrectly associated with an application, the file will not open. To change the association we can go to the file properties and then click on the Change button in the General tab.

 File Association

331.3 – File Association

We can also go to the Control Panel and use the Default Programs option to associate a file type with a program. There we will see all identified file types that exist on the system, along with the application that is used to open that file. When we install an application, file extension associations are created automatically for the file types the application uses.

File Attributes

Every file maintained on our file system has certain attributes associated with it. Four key attributes are ‘hidden‘, ‘system‘, ‘read only‘ and ‘archive‘ attribute. If the hidden attribute (hidden bit) is turned on, that file will not show up while we browse in Windows Explorer. Users that do not know the specific file name of the hidden file can not view or access it. If the system attribute is turned on Windows will protect that file in a special way because it is a system file. System file can not be deleted. If the read only attribute is turned on, we won’t be able to modify and rewrite that file. If the archive bit is turned on, our back up program will know whether or not that file has been backed up. The Archive attribute actually identifies if a file has been modified since the last backup. To see attributes of the file simply right click it and select Properties.

 File Attributes

331.4 – File Attributes

Other file attributes are related to file encryption, file compression andindexing. If a file is encrypted on an Encrypting File System (EFS) such as NTFS, the data is protected when it’s saved in such a way that only the person who owns the data can work with it. To encrypt a file, go to its properties, then click Advanced button and select the ‘Encrypt contents to secure data‘ option. After we click OK we will have to select whether we want to encrypt the file and the folder or do we just want to encrypt the file.

 Advanced Attributes

331.5 – Advanced Attributes

In our case we will only encrypt the file. Notice that the title of the document has changed to green to indicate an encrypted file.

 Encrypted File

331.6 – Encrypted File

If a file is compressed it’s written in a format which takes less space on our hard drive. To compress a file, go to its properties, on the General tab click on the Advanced button and select the ‘Compress file to save disk space‘ option. In our case we have compressed the Tulips file. Notice that the name of the file is colored in blue, which indicates compression.

 Compressed File

331.7 – Compressed File

Files and folders can be encrypted or compressed, but not both at the same time. Indexing attribute tells the system if the file is indexed or not. If an operating system indexes a file it keeps track of the file location and can retrieve it more quickly.

There is a way in which we can see hidden files in Explorer. Let’s go to Folder Options in Control Panel and click on the View Tab. Here we have an option that regulates hidden files and folders.

Hidden Files Options

331.8 – Hidden Files and Folders

Notice that in our case the default is to not show hidden files and folders. If we select the ‘Show hidden files, folders and drives’, we will see all files with hidden attribute set while we browse in Windows Explorer. The only thing that will be different is the file icon which will appear a little bit fainter. That indicates that the icon is actually a hidden file.

 Hidden File

331.9 – Hidden File

Trough Folder Options we can also control the way in which compressed and encrypted files are shown in Explorer. The option that regulates that is named Show encrypted or compressed NTFS files in color. By default this option is selected and that’s what controls the name of these documents showing in the different color.

 Color Options

331.10 – Color Options

File Permissions

NTFS file system associates an Access Control list (ACL) with every file. Those are also called NTFS permissions. The ACL specifies who can work with the file and what they can do to the file or who can’t work with the file and who can’t do anything with the file within the NTFS file system. NTFS supports this, but FAT16 and FAT32 do not. Because of that we should always use NTFS as our file system for XP and newer operating systems. To see the ACL of the file, go to its properties and then open the Security tab. In our case we will check the security of the file named Koala.

 Security Tab

331.11 – Security Tab

Here we can add users and groups and identify the types of actions that they are allowed to perform on those files. If we moving NTFS files to another NTFS partition, the permissions will be preserved. If we move NTFS files to a non-NTFS partition, permissions will be removed.

System Files

By default Windows hides certain operating system files that it doesn’t want us to see or modify. This is a security measure to keep uneducated users from making changes they shouldn’t be making. To show protected system files we can go to Folder Options in Control Panel, then View tab and uncheck the ‘Hide protected operating system files’ option.

 Protected Files Option

331.12 – Protected Files Option

Remember

Files on FAT32 and NTFS can have up to 255 characters in file name. Extensions are included in a filename to indicate a file type. The extension identifies what the file it is, what it contains and what program is used to create and modify the file. Windows associates files with applications by their extension. Every file has certain attributes associated with it. Four key attributes are ‘hidden’, ‘system’, ‘read only’ and ‘archive’ attribute. Other attributes are related to encryption, compression and indexing. By default Windows hides certain operating system files that it doesn’t want us to see or modify. NTFS file system associates an Access Control list (ACL) with every file.