2021年 09月 26日
SUSE Linux から Samba/Windows 共有をマウントしてバックアップ(openSUSE Leap15/SLE15)
ニップンランサムウェア被害から私達にできること
opensuse152:~ # mkdir /mnt/cifsopensuse152:~ # mount.cifs -o user=myname //192.168.1.33/D /mnt/cifsPassword for myname@//192.168.1.33/D: ********opensuse152:~ # ls /mnt/cifs$RECYCLE.BIN System Volume Information download tmp.DS_Store Downloads apps pagefile.sysopensuse152:~ #
opensuse152:~ # umount /mnt/cifs
opensuse152:~ # mount -o user=myname,vers=2.0 //192.168.1.240/share /mnt/cifsPassword for myname@//192.168.1.240/share: *******opensuse152:~ #opensuse152:~ # ls /mnt/cifs/
opensuse152:~ # mount.cifs -o user=myname,vers=2.0 //192.168.1.240/share /mnt/cifsPassword for myname@//192.168.1.240/share: *******opensuse152:~ #
sle153:~ # mount -o username=myname //192.168.1.239/share /mnt/cifsPassword for myname@//192.168.1.239/share: *******mount error(95): Operation not supportedRefer to the mount.cifs(8) manual page (e.g. man mount.cifs)sle153:~ # mount -o username=myname,vers=2.0 //192.168.1.239/share /mnt/cifsPassword for myname@//192.168.1.239/share: *******sle153:~ #sle153:~ # umount /mnt/cifssle153:~ #sle153:~ # mount -o username=myname,vers=3.0 //192.168.1.239/share /mnt/cifsPassword for myname@//192.168.1.239/share: *******sle153:~ #
SMB protocol version. Allowed values are:· 1.0 - The classic CIFS/SMBv1 protocol.: 中略. · 3.1.1 or 3.11 - The SMBv3.1.1 protocol that was introduced in Microsoft Windows 10 and Win-dows Server 2016.: 中略· default - Tries to negotiate the highest SMB2+ version supported by both the client andserver.If no dialect is specified on mount vers=default is used. To check Dialect refer to/proc/fs/cifs/DebugDataNote too that while this option governs the protocol version used, not all features of eachversion are available.The default since v4.13.5 is for the client and server to negotiate the highest possible ver-sion greater than or equal to 2.1. In kernels prior to v4.13, the default was 1.0. For ker-nels between v4.13 and v4.13.5 the default is 3.0.
opensuse152:~ # smbd -VVersion 4.11.14-git.247.8c858f7ee14lp152.3.19.1-SUSE-oS15.0-x86_64opensuse152:~ #
opensuse152:~ # smbstatus -bSamba version 4.11.14-git.247.8c858f7ee14lp152.3.19.1-SUSE-oS15.0-x86_64PID Username Group Machine Protocol Version Encryption Signing----------------------------------------------------------------------------------------------------------------------------------------6126 myname users 192.168.1.33 (ipv4:192.168.1.33:61470) SMB2_10 - -23487 myname users 192.168.1.44 (ipv4:192.168.1.44:50304) SMB3_11 - partial(AES-128-CMAC)26401 myname users 192.168.1.240 (ipv4:192.168.1.240:55066) SMB3_00 - partial(HMAC-SHA256)opensuse152:~ #
PS C:\WINDOWS\system32> Get-SmbConnectionServerName ShareName UserName Credential Dialect NumOpens---------- --------- -------- ---------- ------- --------abianca share GOBLIN\kenn GOBLIN\myname 3.1.1 1PS C:\WINDOWS\system32>
#!/bin/bashmkdir /cifsmount.cifs -o user=backupuser,vers=2.0,password=password //192.168.1.240/share /cifsFILE="/cifs/mounted.txt"if [ -e $FILE ];thenecho "Mounted."##### Your Backup operation Here ! ######syncsleep 5fiumount /cifsumount -f /cifsumount -l /cifsrmdir /cifs
cp -vRu /cifs/* /backup
rsync -av /cifs/ /backup/or
rsync -av --delete /cifs/ /backup
tar cvzf /backup/backup.tar.gz /cifs/*
tar cvzf /dev/st0 /cifs/
mount.cifs — Common Internet File System (CIFS) を使用したマウント
Windows11 を再展開、やり直し、Sysprep