I've been trying to edit my host file for a while now and I keep failing.
I tried to open notepad as administrator and then click File --> Open and choosing the host file but I get this error message:
hosts
You don't have permission to open this file.
Contact the file owner or an administrator to obtain permission.
I tried notepad++ as well (as administrator) but I couldn't even get to the file with it (it doesn't show the etc folder in drivers).
I also tried to check my "User Account Control Settings" but it was already on the lowest level (never notify).
While looking online for a solution I've noticed more people having the same problem but I couldn't find a solution that worked for me.
I'm running Windows 7 Home Premium 64-bit
You have to run notepad++ (or your favorite text editor) as an administrator. Right click notepad++ and it should display an option to run it as admin. Once open, locate the hosts file and open it with notepad++.
Windows hosts file location: c:\windows\system32\drivers\etc
Note: copy and paste the above url in the file-explorer when opening a file within notepad++ instead of locating it manually as some directories are hidden.
If the above doesn't work, Windows 10, 8 sometimes requires you to first turn off your antivirus.
If you require editing the hosts file often, you could look into third-party freeware tools to aid you. [1][2]
This works:
For Windows 7 and Windows Vista
Click Start -> All Programs -> Accessories.
Right click on Notepad and select Run as administrator.
Click Continue on the "Windows needs your permission" UAC window.
When Notepad opens Click File -> Open.
In the filename field type the file location, i.e.:
C:\Windows\System32\Drivers\etc\hosts
Click Open.
Make the necessary changes to the hosts file.
Click File -> Save to save your changes.
In my case I could open the file (and Notepad++ was running as admin) however I could not edit it: I could neither type some text, nor delete anything - no popups, no warnings - it looked like keyboard is not working.
I copied the hosts file in the same location, deleted the original hosts file and renamed the new one to hosts. After that I was able to edit the file. I am guessing this should be some permission issue.
OS - windows 7
But first of all you have to do temporally disable your virus guard.
Dissable your antivirus and open notepad.exe with run as administrator edit your host file and save this.
'Run as admin' not enough in windows 8. Set 'modify' access also not enough if you have antivirus
So you need
1) Disable antivirus
2) Set 'modify' access for all applications
3) Modify 'hosts' file
4) Revert 1-2 steps
OK I got it! I had to right click the file, go to Properties, Security tab and click Edit.
Then I took ownership for the file and I had the ability to edit the file's permissions.
On windows 8 running notepad as administrator wasn't enough for me to edit this file. When I tried to open the file from within an administrator session of notepad the etc directory was empty. I changing explorer to show hidden files and extensions, but that only helped in explorer. To edit this with notepad I needed to modify the security settings on the file so that all users and all applications could write to the file. After I finished my changes I set the file back to read only and execute for all applications and users.
there are two notepad.exe in x64 windows,
you must use full path c:\windows\system2\notepad.exe ,this one is 64 bit version,
only type notepad whithout path may be launch 32 bit notepad.
(c:\windows\syswow64\notepad.exe)
"Run as administrator" just let you enforce launch 64 bit notepad.exe
using 32 bit software to edit c:\windows\system32\drivers\etc\hosts
the x64 system will automatic redirect to c:\windows\syswow64\drivers\etc
and there is no hosts file.
the GUI stiil display current folder is c:\windows\system32
but the real folder is c:\windows\syswow64
I had the same problem. After opening the notepad as an Administrator and editing hosts file, I could not save it (denied access). I could not even change file's permissions. What worked for me was copying the file elsewhere, editing there, and then overwriting the original through Command Prompt opened as Administrator. I didn't have to turn off antivirus program.
To open the Command Prompt as administrator, press windows+X and select that option from the menu.
Than, type: mv path-to-the-copy-of-hosts-file\hosts c:\windows\system32\drivers\etc\hosts
I just needed to uncheck "read only" property to allow modify that file.
Related
Before I did a clean install of my desktop with windows 10 I had .srt to open by default in Sublime Text after I have formatted my computer I somehow miss the file format .srt under 'Choose default apps by file type'.
The .srt should be be between the .srf and .srw file types, but it isn't (as shown in the image here: https://answers.microsoft.com/en-us/windows/forum/windows_10-desktop-winpc/srt-files-back-to-unknown-application/e33cace8-dd59-4557-9631-e8e82a8307b3?auth=1).
If I try "open with and find Sublime (or any other software for that matter, it will open it, but it will not set it as the default program even though I checked the box) and will still appear as an unknown filetype....
If I go into properties and try to change the "open with" from there, it will just keep showing "choose a program" even still.
tried updating the computer and restart it and frankly I've given up, and it doesn't seem anyone have run into this problem before of missing a filetype under 'Choose default apps by file type'.
I also tried
1) Settings - Indexing Options
2) Advanced button
3) File Types tab
4) Add New Extension to List box, type in extension (without a period) such as "py"
5) Click Add, OK and Close
and while the format does appear in the 'Choose default apps by file type', it still doesn't let me change it at all...
Anyone got an answer to this problem?
I have now tried to go into regedit and use "search" on anything that included "sublime" and ".srt" and deleted them all... restarted the computer, reinstall sublime. The file extension I created myself in the indexing option, has been deleted.
Sublime can still open the file, but if you try to make it default program by simply opening it or or going into the files properties and do it that way, it will just open the file without it making it the default program as it should.
going into the indexing option and create the .srt extension format so it can be found under 'Choose default apps by file type' will allow you to choose notepad or wordpad as default program. When I choose either of them, the will just freeze for 1-2 sec and then nothing has changed and the extension havn't been associated with any of the programs.
I tried following the following links, and nothing has worked. Guess I'll just have to accept there is no solution rather than to live with out until I reform my PC again, cause it works without a problem on my laptop and I formatted them both the same time and installed the exact same things on both and the exact same way s:
I've tried to use the following links for help, but to no avail since non of the things I have tried have fixed it.
https://superuser.com/questions/655600/i-cant-set-a-program-as-the-default-to-open-a-filetype-with-in-windows-7
https://superuser.com/questions/91655/open-with-dialog-ignores-my-selection
https://superuser.com/questions/13653/how-to-set-the-default-program-for-opening-files-without-an-extension-in-windows
Windows 7 file extension association
One way to get an empty .srt entry back in the 'Choose default apps by file type' control panel is to create a new key for .srt in your registry under HKEY_CLASSES_ROOT:
Open Registry Editor, e.g. by typing 'regedit' into the start menu or a command prompt
At the top of the tree, right-click on 'HKEY_CLASSES_ROOT', New -> Key
Rename the new key to '.srt' and press enter to save
I have a box running Windows Server 2008 R2.
If I look at a certain directory with Windows Explorer -- c:\windows\system32\inetsrv\config -- I see 2 subdirectories and 3 files.
Then I go into a program and use an open box to open a file. I navigate to that directory. I can see the 2 subdirectories, but no files appear. If I type in the name of the file (applicationHost.cofnig), it says that it does not exist.
I've tried this with Notepad++, Wordpad, and Filezilla Client. The filter is set to ..
What's really killing me is that I'm trying to open this file from within a VB program, and it's saying not found.
Oh, and here's a kicker: If I access the file with a UNC name, then it works. That is, trying to open "c:\windows\system32\inetsrv\config\applicationhost.config" gives a not-found. But if I write "\server1\c$\windows\system32\inetsrv\config\applicationhost.config", then it works. If I change my VB program to use a UNC name, it works. So I suppose I have a work-around, but I'd really like to understand what's going on.
If instead of logging into the server, I run Notepad++ on my desktop, and enter \server1\c$ and then navigate from there, all three files show up.
Oh, and also, if in Windows Explorer I right-click the file and select "edit with notepad++", it opens. But from within Notepad++, trying to use the open box doesn't work. I tried navigating through the directory tree, and I tried just typing in the full path. Either way, "not found".
I checked my permissions and it says I have "full access" to the directory and to the file.
I am attempting to open a .MSI installer package file to modify it. Whenever I try to open it, it opens in read-only mode. I see this with Orca, with InstEd, or when opening the file directly via code:
`MsiOpenDatabase()` (ERROR_OPEN_FAILED with MSIDBOPEN_DIRECT or
MSIDBOPEN_TRANSACT persistence modes).
The file itself does not have the read-only attribute set (in fact, has no attributes set)
I am using an account with Administrators group access
As far as I can tell, no other process has the file open
No installs are in progress or suspended
I can copy the file to another location, and open it read/write there. But the original, I cannot touch
Thanks in advance for your help.
My guess is that this is caused by one of the following factors:
Custom NTFS access rights - defined for the file in its security descriptor
The file might be "blocked" - marked with a special flag after being downloaded via Internet Explorer.
The resolution for the latter is to right click the file and select properties and click the unblock button at the bottom of the property page and pressing OK.
The resolution for custom NTFS rights are done in a similar way by going into the security
tab of the property page for the file, but it is easier just to copy and paste the file and use the fresh copy with the default security.
Found it.
#Glytzhkof, you almost had it but there's a detail I did not know about, and left out. This is a package that lies in a folder under "access protection" by my system's anti-virus program: a filesystem hook that blocks modification of critical system and AV files. Turn off access protection temporarily, and the file is wide open.
Fortunately, one of my teammates had some experience with this, and suggested I try it. Bingo.
Thanks, all.
What I have done to get it working was to create first a backup of the MSI file, and then open that backup. It worked for me
Try to close/kill processes that might interfere, for example:
Other running Install shield instances
Installshield updater
Installshield licensing service
Antivirus
I have an addin program that works with MS Word (version 2007). It is located in the C:\Program Files location. I installed Windows 7 and then went to make a routine change to my files in this location and it would only bring up a read only file. How can I grant myself permission to write to my own program? I cannot change this location or use any other workaround. I have this product out to 25 different companies and I can't change the programming to work from any other location. Thanks
You could also embed a manifest in your EXE that makes your program require adminrights on Windows 7 / Vista.
On Windows Vista, UAC means that users run without admin rights and don't have write access to the program files directories.
The correct solution is to write to a folder for which standard users do have write permissions.
The solution you are looking for is to make your app's folder within program files writeable to all users. You can do this by adding a DACL when installing. It is extremely bad practice to allow standard users to write inside the program files directory and I urge you instead to re-code your app so that it does not need to write there.
Assuming you're doing this as part of modifying the config (and not when your application is running for regular users)...
Your user account probably doesn't have the correct permissions to write/modify the file. Assuming your account is an administrator account, right-click the file, select "Properties". Click the "Security" tab. Click edit and give your user account Full Control.
If you can't do this, it's probably because the ownership of the file doesn't allow you. If this is the case, click on "Advanced", go to the "Owner" tab, and click "Edit".
However, if it needs these permissions when it's running, you should instead be using the %AppData% folder.
I am trying to setup a batch file to copy files from my XP laptop
to my Vista desktop on a workgroup network.
But I am getting a Access denied error. Same in a command prompt.
I can copy the files fine using Windows Explorer.
Any ideas please?
Malcolm
I'm assuming you've setup a share on Vista that you are accessing in XP.
In Vista, make the share accessible to everyone anonymously:
Right-click the folder you're sharing, and click Properties.
Click the Sharing tab, then Advanced Sharing
Click Permissions.
Click Add.
Under "Enter the object names to select", type "Everyone" (without quotes).
Click OK.
Select Everyone in the "Group or user names" box.
Under "Permissions for Everyone", check the Allow box for Full Control.
Click OK three times.
You should probably map that share as a network drive on your XP computer.
That should work.
EDIT: I have tested this with the exact same conditions you described, and it worked.