The “new” => “text document” went missing

On windows 11, the document type I create the most through right click / new menu is the text document, Today, i click in a folder, and it is missing, and in its place was a bunch of open office document types !

Turns out to bring it back I have to put the following text in a .reg file and run it, then restart explorer or windows

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.txt\ShellNew]
"ItemName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,00,2c,00,2d,00,34,00,37,00,30,00,00,00
"NullFile"=""

[HKEY_CLASSES_ROOT\txtfilelegacy]
@="Text Document"

But now since I am here, I want to also add a new => html file to that very menu

1- Create a file called (template.html) ideally you would want to save it in %Allusersprofile%\Templates, in my case the explicit location would be “C:\ProgramData\Templates”, but you will probably get an access denied error, to spare you the hassle of working around that, you can simply create a new folder inside C:\ProgramData\ called ExtraTemplates and store the file there

Now, put the following in a reg file and run it

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.html\ShellNew]
"FileName"="%Allusersprofile%\ExtraTemplates\html.html"

Enjoy

Windows classic right click menu

re-enabling the old pre windows 11 context menu (Mouse right click menu) is as simple as running the following command in your terminal

reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

You obviously need to restart explorer, or your PC after this, but there is nothing more to it, short and simple

In windows 11 the complete context menu is available through the “show more options” option in the new menu, the new menu is a subset of the old, so why not have the old pop up from the word go

Enjoy your windows 11 with a windows 10 like context menu 😉

Apps won’t run without an internet connection

As part of my paranoia when using windows (Fear of ransomware or spyware or otherwise), I allow my web browser to connect via proxy, and the rest of the machine’s apps have no internet access (Which is a KVM virtual machine, with USB and graphics passthrough)

Now, recently, Applications are no longer running on windows 10 ! Instead, I am getting a message that reads :

SmartScreen can't be reached right now. 

Check your internet connection. Microsoft defender SmartScreen is unreachable and can't help you decide if this app is okay to run.

Publisher: xxxx
App: xxxx

This seems to be something relevant to Microsoft security, where windows consults with Microsoft before running an app for the first time !

My solution is to disable it, why, because I have to pick one method or the other to protect my computer, and antivirus software, although works if you download torrents etc… doesn’t really detect the latest threats, when they say detects and removes 99% of viruses, this includes all viruses from 1981 onward, and very few of the most recent viruses and threats, so the question remains, if i am not downloading torrents and the like, what are the odds i would meet Michelangelo

So, the steps to disable this are as follows

Disable windows defender antivirus [2024]

Recently, Windows defender antivirus has become very hard to disable in Windows 10 (And probably 11), previously, you would disable tamper protection, then open gpedit.msc, navigate to the setting and voila, recently, doing this o longer works, now, as soon as you close group policy editor (gpedit.msc) and open it again, the setting to disable windows defender antivirus pops up again ! You were also abe to do this from the registry, which does not work now.

So, it turns out that you need the following extra steps now, So here are the complete instructions

1- Start as you would by disabling tamper protection, you can do that by going to “Windows security”, then Virus and threat protection, then click on the “Manage settings” button, and finally disable tamper protection

2- Create a file with the .REG extension containing the following and execute it !

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SecurityHealthService]
"Start"=dword:00000004

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\wscsvc]
"Start"=dword:00000004

Now execute the above, if it does not work because “binary values can only be edited manually”, then you will need to visit the locations above in regedit (Run as administrator) and switch the values of both to (4) which means disabled

Now before proceeding to the following procedure (The same OLD procedure), You will need to restart your computer for the settings above to take effect

  • Run gpedit.msc as administrator
  • Computer configuration => Administrative templates => Windows Components => Microsoft defender antivirus
  • Now, you should find the entry “Turn off Microsoft defender antivirus”, double click it, and select Enable then okay
  • Restart your computer again

A message still appears urging me to enable it, Click the three dots at the top of that message and disable this notification so that you won’t accidentally re-enable antivirus by clicking the message

Sunshine and moonlight

VNC and RDP are great and all, and for so many purposes, they are the goto solution for remoting into a machine.

Now, another solution which is great (And much better if you have the bandwidth) is to broadcast your screen video and do all the work on the server rather than the client

The solution used to be nvidia’s game stream, which was abandoned by nvidia, the new solution based on nvidia would be the sunshine (Server) and moonlight client

The sunshine+moonlight duo work on almost every platform I need, Windows, Mac, Android, iOS, Even LG TVs running web OS… in short, it is a more universal solution. You can even create a virtual non existent monitor under linux and stream that to a different device !

So, let us start with the server (Sunshine)

Sunshine on debian

Installing sunshine on debian is very easy as a .deb installation file is provided, sunshine is not yet in the debian repositories, but if i understand the license correctly, it can be some time in the future

Now, go to the sunshine website, and download the deb file., in my case, I visit this webpage, and download the sunshine-debian-bookworm-amd64.deb file

Now, from the command prompt, su (to run as root), then cd to the directory where your deb file resides, then “sudo apt install ./sunshine-debian-bookworm-amd64.deb”, We should now have the server running and waiting to be opened in the web browser, Now, on the command line , type “sunshine”

Point a web browser to https://localhost:47990/, ignore the problem with self signed certificates, and set your username and password

Now, your debian computer is running a sunshine server, go to any other machine where you want to install the client (moonlight) from here , and connect to your server by its IP address.

You are done !

Sunshine on Windows

Download sunshine on windows from the latest release (As of today, you will fine it here)

Install it like you would any other application, once done, the official help page will show up (this)

once you click finish, a page at https://localhost:47990/welcome will open, asking you to create a password, create one, the default username is sunshine, but you can use whatever you want (In my case, it is my default RDP password)

you are done, you can now access the windows PC from any device with moonlight

Moonlight on Windows

you can download moonlight ether from github (Here) or from the official website (https://moonlight-stream.org/),

Mounting unclean NTFS windows drive in Linux

Whenever i get the following message

mount /dev/sdd1 /hds/sgt2tb
The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
Falling back to read-only mount because the NTFS partition is in an
unsafe state. Please resume and shutdown Windows fully (no hibernation
or fast restarting.)
Could not mount read-write, trying read-only

The command

ntfsfix /dev/sdd1

resolves the issue, and produces the following message

Mounting volume... The disk contains an unclean file system (0, 0).
Metadata kept in Windows cache, refused to mount.
FAILED
Attempting to correct errors...
Processing $MFT and $MFTMirr...
Reading $MFT... OK
Reading $MFTMirr... OK
Comparing $MFTMirr to $MFT... OK
Processing of $MFT and $MFTMirr completed successfully.
Setting required flags on partition... OK
Going to empty the journal ($LogFile)... OK
Checking the alternate boot sector... OK
NTFS volume version is 3.1.
NTFS partition /dev/sdd1 was processed successfully

The same mount command you see here will now work flawlessly

mount /dev/sdd1 /hds/sgt2tb

I am still unsure what process from the mentioned above is responsible, as this oftentimes pops up on drives that were never system drives, so there is no hibernation file problem

Mounting a remote Linux file system as a Windows drive

You can do this in many ways, the most popular of which is SAMBA, but this is not the software we are using, here we are using SSHFS

The software this post is about is SSHFS, if you are reading this, you probably know what SSH is (Secure shell), and FS stands for File System

Ironically, you will only need to have SFTP and not SSH with shell access, so here is the first surprise, Now, to continue with this tutorial, you might want to visit the page I have posted here to create that user and give him/her access to the directory to be mounted, don’t worry, there is a link back here at the bottom of that page !

So, now that you have created that user account on the remote system, let’s get down to business

You will need 2 peices of software, or 3 if you would like to use private/public key authentication

For the following software, look on their websites for the latest installers for your version of Windows (Usually you are looking for the msi of the 64bit version of windows)

1- WinFsp, short for Windows File System Proxy, What this basically does is enabled the developer of SSHFS-Win to make it look like a windows drive, not some separate SFTP application where you have to move the files manually, when you present it as a drive, you can modify files directly on it, which is the main advantage, and it will do the work in the background, it is a driver that presents itself on/to windows as a disk, while cheating the disk contents from another application, the github page for it is at https://github.com/winfsp/winfsp, or to save you time, Just go directly to the download page here https://github.com/winfsp/winfsp/releases/tag/v1.11 , When presented with optional components, if you are not a developer, you will only ever need the Core package, which is the installer’s default

Once WinFsp is installed, we are done with the part that allows us to display file systems that are not really filesystems, the next step is to have something feed that with data from an actual filesystem somewhere else ! via SFTP, and that software would be

2- SSHFS-Win, which is the system that sits in the middle, between the SFTP server, and WinFsp which is an illusion of a hard drive on your windows machine ! it’s home on github is at https://github.com/winfsp/sshfs-win, To get the latest from this one, go here https://github.com/winfsp/sshfs-win/releases and look for the one that says latest (Not pre-release), download and install it

There is no software to install on the remote side, as most Linux systems already have the functionality ! and you have already setup a user in the previous post that I pointed you to a minute ago, So let us mount !

Now, you can (But don’t do it just yet) open file explorer in Windows, right click “This PC”, and click on Map Network Drive, A dialogue appears, enter your connection string, which should be something like

\\sshfs\username@serverhostname\

You should then be prompted with a password dialogue box, you enter the SFTP password, and you should now be all set, but why are we not doing this right now ? we are not doing this because when you create files in that drive, they will remotely have rwx permissions for owner, and no permissions for group or others, wo work around this, you need to pass the following arguments to the mount

webdev@10.10.20.41:/

create_file_umask=0000,create_dir_umask=0000,umask=0000,idmap=user,StrictHostKeyChecking=no

which is only available via command line and does not survive reboots, a better alternative is to use sshfs-win-manager, which seamlessly mounts those remote file systems using SFTP , the long and short of it is that it just works


Another program that has a different set of permission issues (I can write files, but can’t write to them again even though i own the files on the remote system and the permissions should allow) is SiriKali (https://github.com/mhogomchungu/sirikali), you should be able to find the line to download for your platform here (https://mhogomchungu.github.io/sirikali/)

SiriKali also allows you to use other types of authentication which are beyond the scope of this post

So in SiriKali, you need to fill the above information, luckily that information is loaded by default.

Remember to select the checkboxes you need,

Static IP on Hyper-v (Debian Guests)

One problem i face when developing using Hyper-v is that I need static addresses, and the default switch keeps changing the ip range

The simplest solution to this is to create a new switch of type internal ! this only connects the virtual machines to each other (Static IP etc…), and can not access the internet

Right after creating an INTERNAL switch in the switch manager, you go to “Manage network adapter settings” on the host computer, and assign an IP such as 10.10.20.1 to the adapter and a subnet of 255.255.255.0, no gateway, and nothing but those IPs.

Once that is done, you add a second adapter to all the virtual machines, and in the /etc/network/interfaces file, you leave eth0 the way it was (For internet) and add a metric 10 under the last line for eth0, then add the following stanza for the new adapter (Assuming eth1), eth 1 has a higher cost in it’s metric, so unless the remote is on the eth1 subnet, it will go through the eth0

auto eth1
iface eth1 inet static
 address 10.10.20.41/24
 metric 100

And you are done, those virtual machines can address each other with their 10.10.20.x addresses, and access the outside world via the other network interface.

Installing Hyper-v on a windows 11 Home edition

To install Hyper-v, you typically open the add features menu in windows and add Hyper-v, this works in Windows Pro, but does not work in windows Home

In Windows Home, it is a very simple process

Create a file and name it (hv.bat), mind you, this is the whole name, where bet is the new file extension, make sure you don’t have an hv.bat.txt undreneath (Make sure windows is showing you the extensions)

Now, All you need to do is put the following text in the batch file (hv.bat), then Run it as administrator

     pushd "%~dp0"
     dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hv.txt
     for /f %%i in ('findstr /i . hv.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
     del hv.txt
     Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL
     pause

Once done, the command prompt will ask you whether you would like to restart your computer to apply changes, I would suggest you respond with N (For no) and take your time closing all your applications etc… then restart manually

Right after the restart, hit the windows key on your computer, and type hyper-v, the application should appear and you can run it, it works just like it does on the pro version

Happy computing 😉