Hosts file is being deleted by UltraEdit 21.20

Hosts file is being deleted by UltraEdit 21.20

1

    Sep 23, 2016#1

    Hi,

    I have a work laptop that is admin locked down so I cannot add/remove/change software.
    Even the local hosts file I have to get elevated rights for to manage.

    Last week my work pc was Re-imaged and UltraEdit was downloaded by it support remotely.

    Until this week I was editing my hosts with notepad / vi (I also use Cygwin) but once UltraEdit was installed I switched over (I did not have a configuration to important just set the look and feel of the UI)

    All seemed fine for a few hours until I got a Windows error the file was no longer there.
    After troubleshooting with it I was able to edit and keep hosts fine but each time I opened in UltraEdit and saved the file vanished.

    I checked UltraEdit config and delete before save us not enabled and can't see anything else that could be causing this (config wise).

    Any ideas?

    6,675585
    Grand MasterGrand Master
    6,675585

      Sep 23, 2016#2

      The hosts file is special protected by Windows as you might know. You need administrator rights to be able to edit it at all. As UltraEdit creates by default a copy of the file to edit in temporary files, it is always possible to load the hosts file and modify it. But on save Windows protection becomes active and it depends on how the save is done.

      By default is enabled the creation of backup files in same directory as the edited file. The backup file is created by default by renaming the original file and then moving the modified temporary file to directory of the original file. This most efficient method for creating a backup file does not work on hosts file.

      It is necessary to
      • edit the hosts file without using a temporary file resulting in all changes are immediately applied on original file with no undo possible and file lock set on file until opened in UltraEdit, see Advanced - Configuration - File Handling - Temporary Files and use button Help for more information about those settings;
      • or disable creation of backups before opening the hosts file and if wanted at all enable this feature after hosts file edited, saved and closed (no rename of original file occurs);
      • or configure a directory for all backups created to avoid creating backups in directory of original file which avoids also renaming of the original file;
      • or enable Copy file instead of using rename when creating backup file at Advanced - Configuration - File Handling - Advanced to copy the original file to backup file instead of renaming it and overwrite the original file next with contents of temporary file. Press button Help in the configuration dialog for more information about this setting making creation of backups in directory of original file slower, but must be sometimes used to keep special file permissions like on hosts file.
      Note: None of the 4 suggestions was really tested by me, but all of them should work whereby I suggest to use one of the last 3 suggestions.
      Best regards from an UC/UE/UES for Windows user from Austria