2021年 09月 26日
Linuxから mac/NAS/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:~ #
-- オマケ --openSUSE Leap 15 で macOS の共有のマウント
opensuse152:~ # mount -o username=myname //192.168.1.50/myname /mnt/cifsPassword for knakaj@//192.168.1.50/mysname : *******opensuse152:~ # ls /mnt/cifs -ltotal 100drwxr-xr-x 2 root root 0 Jun 11 2022 Applications-rwxr-xr-x 1 root root 2538 Mar 16 10:43 aria2_download.log-rwxr-xr-x 1 root root 37 Jul 20 2022 .bash_profiledrwxr-xr-x 2 root root 0 Oct 8 2022 BGMdrwxr-xr-x 2 root root 0 Jun 12 2022 .cache-rwxr-xr-x 1 root root 7 Jun 11 2022 .CFUserTextEncodingdrwxr-xr-x 2 root root 0 Dec 14 10:54 cifsdrwxr-xr-x 2 root root 0 Oct 27 2022 .configdrwxr-xr-x 2 root root 0 Jun 11 2022 .cupsdrwxr-xr-x 2 root root 0 Oct 6 2022 DavinciResolvedrwxr-xr-x 2 root root 0 Mar 31 14:45 Desktop: 略opensuse152:~ #
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) を使用したマウント
パスワードに特殊記号が入っているとエラーになってコマンドラインからマウントできない事がある。
mac で samba/NAS/Windows 共有、コマンドラインで mount しようとしてハマる
Windows11 を再展開、やり直し、Sysprep
ファイル名の問題:開けない共有のフォルダ、ファイル:ファイル名に問題があって、Windows 側でアクセスできない問題
mac OS のファイル共有のはじめ方、Windows や Linux でファイル共有
他サイトのコマンドでは「mount -t cifs」となっていたのですがマウントできず、こちらの「mount -o ~」でうまくできました。
感謝です!