General Notes
Windows
Expand a windows partition after expanding the virtual disk (Ex. sendys)
Note: Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows 7, Windows 8 and Windows Server 2012, Windows 8.1, Windows 10 and Windows Server 2012 R2 can expand the volumes from the Disk Management in Computer Management. Right-click on Volume and click Extend Volume. For more information, see Microsoft's documentation. Instead of rebooting the guest operating system, in Computer Management, right-click Disk Management and click Rescan Disks.
OSX
Reset password on OSX
Turn off your Mac (choose Apple > Shut Down). Press the power button while holding down Command-R. The Mac will boot into Recovery mode. When you see the load bar appear you can let go of the keys. It may take a few minutes to load. Select Disk Utility and press Continue. Choose Utilities > Terminal. Enter resetpassword (all one word, lowercase letters) and press Return Select the volume containing the account (normally this will be your Main hard drive). Choose the account to change with Select the User Account. Enter a new password and re-enter it into the password fields. Enter a new password hint related to the password. Click Save. A warning will appear that the password has changed, but not the Keychain Password. Click OK. Click Apple > Restart
FreeNAS
Mounting NFS Volumes (ex. external usb disks) on FreeNAS
mkdir /mnt/usb kldload fuse ntfs-3g /dev/da0s1 /mnt/usb/
Zentyal
Showing Password Policy Settings
$ sudo samba-tool domain passwordsettings show Password informations for domain 'DC=arditi,DC=pt' Password complexity: off Store plaintext passwords: off Password history length: 24 Minimum password length: 0 Minimum password age (days): 0 Maximum password age (days): 365 Account lockout duration (mins): 30 Account lockout threshold (attempts): 0 Reset account lockout after (mins): 30
Changing Password Policy Settings
Set password complexity
$ sudo samba-tool domain passwordsettings set --complexity=on
Set password minimum length
$ sudo samba-tool domain passwordsettings set --min-pwd-length=6
Disable Password Expiration
$ sudo samba-tool user setexpiry USER --noexpiry Expiry for user USER disabled.
Re-enable Password Expiration
see: https://www.samba.org/samba/docs/current/man-html/pdbedit.8.html
$ sudo /usr/bin/pdbedit -u caguiar -r -c [-X] ldb_wrap open of idmap.ldb Unix username: caguiar NT username: Account Flags: [U ] User SID: S-1-5-21-1969551146-1524703261-742246316-1105 Primary Group SID: S-1-5-21-1969551146-1524703261-742246316-513 Full Name: Clemente Aguiar Home Directory: \\hera.ARDITI.PT\caguiar HomeDir Drive: H: Logon Script: Profile Path: Domain: Account desc: Workstations: Munged dial: Logon time: Thu, 09 Apr 2020 16:44:52 WEST Logoff time: 0 Kickoff time: 0 Password last set: Sun, 19 Apr 2020 15:09:32 WEST Password can change: Sun, 19 Apr 2020 15:09:32 WEST Password must change: never Last bad password : 0 Bad password count : 0 Logon hours : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Linux
Disable Linux Account
The correct way according to usermod(8) is:
usermod --lock --expiredate 1970-01-02 <username>
(Actually, the argument to --expiredate can be any date before the current date in the format YYYY-MM-DD.)
Explanation:
--lock locks the user's password. However, login by other methods (e.g. public key) is still possible. --expiredate YYYY-MM-DD disables the account at the specified date. According to man shadow 5 1970-01-01 is an ambiguous value and shall not be used.
Re-enable Linux Account
usermod --unlock --expiredate <username>
Change the space reserved for root on an ext2, ext3 or ext4 filesystem
The reservation can be changed using the -m option of the tune2fs command:
tune2fs -m X /dev/sda1
The X number is the required percentage (without a percentage sign). If successful, tune2fs should report the new reservation with a message of the form:
tune2fs 1.41.12 (17-May-2010) Setting reserved blocks percentage to X% (y blocks)
Ubuntu: How do I find the package that provides a file?
Reference: https://askubuntu.com/questions/481/how-do-i-find-the-package-that-provides-a-file
You can use dpkg command to find out which installed package owns a file:
From man dpkg:
-S, --search filename-search-pattern... Search for a filename from installed packages.
Example:
$ dpkg -S /bin/ls coreutils: /bin/ls
You can either search with a full path or with just the filename.
Ubuntu Servers: adjust swappiness
Reference: http://ubuntuguide.net/optimize-the-usage-of-swap-to-speed-up-response-for-ubuntu
First, check the value of swappiness:
cat /proc/sys/vm/swappiness
Set the swappiness value to 10 (production server):
sudo sysctl vm.swappiness=10
To permanently change this value, create a file 20-swappiness.conf in /etc/sysctl.d with the following line:
vm.swappiness=10
Certbot
Add additional domain to an existing certificate
sudo certbot certonly --cert-name oomvisor.arditi.pt -d oomvisor.arditi.pt,geoportal.arditi.pt