Windows 帳號最近一次變更密碼查詢
net user [[user id]]
net user [[user id]] /domain
Linux 帳號最近一次變更密碼查詢
方法1:chage -l [[user id]]
方法2:查詢/etc/shadow 第三個欄位,最近一次密碼修改的天數(距離 1970/01/01的天數)
date -u -d "1970-01-01 UTC $((19523 * 86400 )) seconds" (19523)
範例 查詢 root
busybox date @$(expr $(cat /etc/shadow |grep root|cut -d : -f3) \* 86400 )
其他
Linux 密碼規則設定檔 /etc/login.defs
2023年6月29日 星期四
Windows Linux 帳號最近一次變更密碼查詢
2023年6月20日 星期二
Debian 11 安裝 Samba 摘要
安裝相關軟體
apt install samba smbclient cifs-utils
增加 Linux系統中帳號,群組
groupadd smbshare
useradd -M -s /sbin/nologin sambauser
usermod -aG smbshare sambauser
建立 samba 系統帳號
smbpasswd -a sambauser
啟用 samba 系統帳號
smbpasswd -e sambauser
建立分享目錄
mkdir /private /public
chgrp -R smbshare /private
chgrp -R smbshare /public
chmod 2770 /private
chmod 2775 /public
編輯 Samba 設定檔 /etc/samba/smb.conf
[public]
comment = Public Folder
path = /public
writable = yes
guest ok = yes
guest only = yes
force create mode = 775
force directory mode = 775
[private]
comment = Private Folder
path = /private
writable = yes
guest ok = no
valid users = @smbshare
force create mode = 770
force directory mode = 770
inherit permissions = yes
測試設定檔
testparm
Proxmox VE LXC 使用 xfs 摘要
PVE HOST 安裝 xfs 工具
apt install xfsprogs
PVE HOST 格式化 xfs
mkfs.xfs
PVE HOST 變更 LV 大小
lvresize
PVE HOST 轉換檔案系統
xfs_growfs -d /mountfs
ext4 轉 xfs 工具
fstransform
2023年6月13日 星期二
Proxmox ve LV 異常
訊息
activating LV 'pve/data' failed: Activation of logical volume pve/data is prohibited while logical volume pve/data_tmeta is active.
修復步驟
lvchange -an pve/data_tdata
lvchange -an pve/data_tmeta
lvchange -ay pve/data
2023年6月2日 星期五
ssh 指定加密方式
查詢 ssh 支援密碼類型
ssh -Q cipher
指定 scp 加密方式
scp -o Ciphers=aes256-gcm@openssh.com file host:/dev/null
2023年5月31日 星期三
LSI storcli 安裝
url="https://docs.broadcom.com/docs-and-downloads/raid-controllers/raid-controllers-common-files/007.1613.0000.0000_Unified_StorCLI-PUL.zip"
apt-get install -y alien
apt-get install -y libncurses5
opwd=`pwd`
mkdir /tmp/StorCLI
cd /tmp/StorCLI
wget -q -O- ${url} |busybox unzip -
cd Unified_storcli_all_os/Linux
alien storcli-007.1613.0000.0000-1.noarch.rpm
dpkg -i storcli_007.1613.0000.0000-2_all.deb
cd $opwd
安裝路徑
/opt/MegaRAID/storcli
2023年5月30日 星期二
sqfs + luks 加密
建立 sqfs 檔案
mksquashfs /path/to/my/directory image.sqfs
truncate -s +8M image.sqfs
cryptsetup -q reencrypt --encrypt --type luks2 --resilience none --disable-locks --reduce-device-size 8M image.sqfs
掛載使用
losetup /dev/loop0 image.sqfs
cryptsetup luksOpen /dev/loop0 Encdisk
mount /dev/mapper/Encdisk /mnt
卸載
umount /mnt
dmsetup remove Encdisk
losetup -d /dev/loop0