Garbage

What kind of trash is usually found in the backyards of industrial areas?
Construction debris, rusty car frames, empty liquid containers.
Now we can meet this too:

 

Fix ubuntu apt-get and release upgrade errors

Fix fetching updates:

When you get “Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?” error do this:

cd /etc/apt
mv sources.list sources.list.old
lsb_release -a
sudo cat sources.list.old |grep RELEASECODENAME |grep -v "#" |sed 's|us.archive.|old-releases.|g' >> sources.list

(del and retype >> in console if error occures)

 

https://www.tech-notes.net/issues-wit-apt-ubuntu-12-04/

https://stackoverflow.com/questions/38743951/unable-to-fetch-some-archives-maybe-run-apt-get-update-or-try-with-fix-missin

https://askubuntu.com/questions/91815/how-to-install-software-or-upgrade-from-an-old-unsupported-release/91821#91821

 

Resume a release upgrade:
https://askubuntu.com/questions/346678/how-do-i-resume-a-release-upgrade

Mount SMB share in Ubuntu

apt-get install cifs-utils
mkdir /var/tmp/sharetest
One time until reboot, read only:
mount -t cifs -o sec=ntlm,noperm,nounix,vers=3.0,username=USERNAME,password=PASSWORD //XXX.XXX.XXX.XXX/test /var/tmp/sharetest -r
Permanently, read only:
nano /etc/fstab
//XXX.XXX.XXX.XXX/test      /var/tmp/sharetest              cifs    ro,sec=ntlm,noperm,nounix,vers=3.0,username=USERNAME,password=PASSWORD 0 0

crontab -e
* * * * * mount -a #Reconnect mounted shares after they disconnect for some reason (network failure for example)

https://askubuntu.com/questions/940132/windows-shares-not-reconnecting

Fail2ban Info

Some useful info:

https://www.digitalocean.com/community/tutorials/how-to-protect-an-nginx-server-with-fail2ban-on-ubuntu-22-04
https://linux-notes.org/ustanovka-fail2ban/
https://github.com/Bebef/fail2ban-filter.d
https://stackoverflow.com/questions/19794107/fail2ban-error-can´t-ban-with-lighttpssd-auth
https://easyengine.io/tutorials/nginx/fail2ban/

Check who’s banned:

fail2ban-client status JAILNAME

fail2ban alerts sent to a Rocket.Chat channel:

https://forums.rocket.chat/t/fail2ban-and-rocket-chat-integration/2544

Incremental bantime:

https://habr.com/ru/post/238303/

Check how filter works:

fail2ban-regex /var/log/somelog.log /etc/fail2ban/filter.d/somefilter.conf
Add –print-all-missed or –print-all-matched to see missed and matched lines.

Windows Tuning

All Windows versions:

Show extensions of known file types:

ext.vbs:

HKEY_CURRENT_USER = &H80000001
strComputer = “.”
Set objReg = GetObject(“winmgmts:\\” & strComputer & “\root\default:StdRegProv”)
strKeyPath = “Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced”
objReg.CreateKey HKEY_CURRENT_USER, strKeyPath
ValueName = “HideFileExt”
dwValue = 0
objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, ValueName, dwValue

 

Always show all icons and notifications in tray:

HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer!EnableAutoTray=0

 

Make Windows search inside file contents 1 & 2:

Type in content: into the search bar. Anything that you type after this prompt will be used as a content search term.

Search for Indexing Options in Start,
Go to Advanced,
Select the “Index Properties and File Contents” option,
Add needed files extensions if they are absent in list.

Go to Folder and Search Options,
On the “Search” tab, select the “Always search file names and contents” option.
Windows Server 2012:
Включить отобржение активности дисков в таксменеджере:
diskperf -Y
https://blogs.technet.microsoft.com/canitpro/2013/12/02/step-by-step-enabling-disk-performance-counters-in-windows-server-2012-r2-task-manager/

 

Disable Narrator forever (Windows + Enter hotkey):

Open regedit.exe.
Create the following key.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\Narrator.exe
In that key, create a new string value named Debugger and assign it the value %1.

 

Disable text/ink collection:

HKLM\SOFTWARE\Policies\Microsoft\InputPersonalization RestrictImplicitTextCollection REG_DWORD 1
HKLM\SOFTWARE\Policies\Microsoft\InputPersonalization RestrictImplicitInkCollection REG_DWORD 1

 

Disable “This app is preventing shutdown”:

HKEY_USERS\.DEFAULT\Control Panel\Desktop
Create new stringkey “AutoEndTasks” with value  “1”

reg add "HKEY_USERS\.DEFAULT\Control Panel\Desktop" /v AutoEndTasks /t REG_SZ /d 1

 

Change user appearance via one file:


Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Desktop]
"UserPreferencesMask"=hex:00,20,04,00,80,00,00,00

In this example everything is disabled except: Peek, Thumbnail previews, Thumbnails instead of icons, Translucent selection rectangle, Window contents, Smooth edges, Drop shadows icons.

There is a software UserPreferencesMask calculator, but it doesn’t work on Windows higher than 7.
https://www.silisoftware.com/tools/tweakui.php

Also there is a complete list of registry values of each feature:
https://www.bleepingcomputer.com/forums/t/416401/advanced-system-settings-performance-to-all-user-accounts/#entry3467731

 

Enable Office automatic updates 1 & 2:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Office\15.0\Common\OfficeUpdate]
“EnableAutomaticUpdates”=dword:00000000
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Office\15.0\Common\OfficeUpdate]
“HideEnableDisableUpdates”=dword:00000000

 

Show Product (License) Key stored in BIOS:
https://www.kiloroot.com/how-to-get-your-windows-activation-key-from-uefi-bios/

In Powershell:
wmic path softwarelicensingservice get oa3xoriginalproductkey

Create persistent disk from folder:
https://superuser.com/a/217621
https://superuser.com/questions/1734542/how-to-change-the-drive-label-after-mapping-a-drive-letter-to-a-folder
https://en.wikipedia.org/wiki/SUBST

Add a disk from folder:
reg add “HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices” /v X: /t REG_SZ /d “\??\C:\DirectoryName” /f

Configure new disk’s volume name:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\X\DefaultLabel\
(DefaultValue) = Your Drive Label

 

Change environment valiables in Group Policy:

https://technet.microsoft.com/en-us/library/cc772047(v=ws.11).aspx

Open the Group Policy Management Console . Right-click the Group Policy object (GPO) that should contain the new preference item, and then click Edit .

In the console tree under Computer Configuration or User Configuration , expand the Preferences folder, and then expand the Windows Settings folder.

Right-click the Environment node, point to New , and select Environment Variable .

Change user profile location in Regedit:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\ProfileList.
Set needed location in “ProfileDirectory” key variable.

Delete hiberfil from c:

powercfg /h off

Disable Last Access Timestamp:
https://www.tenforums.com/tutorials/139015-enable-disable-ntfs-last-access-time-stamp-updates-windows-10-a.html

(See current status of Last Access Time Updates)
fsutil behavior query disablelastaccess
OR
(User Managed, Last Access Time Updates Enabled)
fsutil behavior set disablelastaccess 0
OR
(User Managed, Last Access Time Updates Disabled)
fsutil behavior set disablelastaccess 1
OR
(Default – System Managed, Last Access Time Updates Enabled)
fsutil behavior set disablelastaccess 2
OR
(System Managed, Last Access Time Updates Disabled)
fsutil behavior set disablelastaccess 3