Tech Help

Creating Read-Only Files in VM

Interested in sharing your data for collaborative research in the workspace, while ensuring that the original data remains unchanged?

Consider generating a read-only file for the data within your workspace VM as a potential solution. 

How to create a read-only file: 

  1. Create or upload file to your workspace
  2. Enter your workspace VM and follow the steps below for windows or linux. 

On Windows

To set permissions, from a terminal window, enter

Set-ItemProperty -Path z:\path_to_your_file\file.txt  -Name IsReadOnly -Value $true

To verify permissions are set correctly, enter:

Get-ItemProperty -Path z:\path_to_your_file\file.txt | Select-Object IsReadOnly

On Linux

Login as sudo: 

sudo -i

Change the file permissions using chmod:  

chmod 444 file.txt

Restart the VM, and the permissions should stay. 

Note you should not be able to overwrite the file once made read only. However, collaborators can still delete it, so care should be taken to not delete the read-only file.