try ... //save the file except on E: Exception do ShowMessage(E.Message + ' (#' + IntToStr(GetLastOSError) + ')' ); end; ...
sudo chown <your username> <the filename in question>