sc.exe qc lanmanworkstation
Get-SmbConnection
sudo vim /etc/samba/smb.conf -- [global] min protocol = SMB2 -- sudo service smb restart
ホストからアクセスした場合、以下のように「invalid wct number」で失敗する時
sudo tail -f /var/log/samba/192.168.1.xxx.log [2017/07/04 20:08:33.939462, 0] smbd/process.c:525(init_smb_request) init_smb_request: invalid wct number 255 (size 178)
sudo vim /etc/samba/smb.conf -- [global] min protocol = SMB2 max protocol = SMB2 # smb ports = 139 -- sudo service smb restart
man mount.cifs ... - none - attempt to connection as a null user (no name) - krb5 - Use Kerberos version 5 authentication - krb5i - Use Kerberos authentication and forcibly enable packet signing - ntlm - Use NTLM password hashing - ntlmi - Use NTLM password hashing and force packet signing - ntlmv2 - Use NTLMv2 password hashing - ntlmv2i - Use NTLMv2 password hashing and force packet signing - ntlmssp - Use NTLMv2 password hashing encapsulated in Raw NTLMSSP message - ntlmsspi - Use NTLMv2 password hashing encapsulated in Raw NTLMSSP message, and force packet signing
sudo mkdir /mnt/samba sudo vi /etc/samba/mountpw ---- username=<USER> password=<PASS> ---- sudo chmod 600 /etc/samba/mountpw sudo mount -t cifs //192.168.1.10/share /mnt/samba -o credentials=/etc/samba/mountpw,uid=<linux uid>,gid=<linux gid>,iocharset=utf8,file_mode=0644,dir_mode=0755,defaults,nofail,vers=3.0,sec=ntlmv2 sudo vi /etc/fstab ---- //192.168.1.10/share /mnt/samba cifs credentials=/etc/samba/mountpw,uid=<linux uid>,gid=<linux gid>,iocharset=utf8,file_mode=0644,dir_mode=0755,defaults,nofail,vers=3.0,sec=ntlmv2 0 0 ----
sambaをアップデートとした後に、接続できなくなった場合。
パスワードファイルの参照パスが変わった場合がある。
その場合、pdbedit -Lでもユーザが出て来ない
smbd -b | grep SMB_PASSWD_FILE SMB_PASSWD_FILE: /var/lib/samba/private/smbpasswd testparm -v | grep private private dir = /var/lib/samba/private
vim /etc/samba/smb.conf ---- smb passwd file = /etc/samba/smbpasswd private dir = /etc/samba ---- service smb restart
sambaのnetコマンドを使ってLinuxからWindowsを操作する。
yum install samba rpm -qa | grep samba samba-3.6.9-151.el6_4.1.x86_64
# 再起動 net rpc shutdown -r -f -t 30 -C 'message' -I 192.168.1.100 -U 'username%password' # シャットダウン net rpc shutdown -f -t 30 -C 'message' -I 192.168.1.100 -U 'username%password'
testparm -v
vim /etc/samba/smb.conf ---- [global] dfree cache time = 60 ---- service smb restart
VER=$(grep -o -P '\d+' /etc/redhat-release | head -1) wget http://wing-net.ddo.jp/wing/${VER}/EL${VER}.wing.repo -O /etc/yum.repos.d/EL${VER}.wing.repo yum install samba3x samba3x-client --enablerepo=wing service smb restart service nmb restart chkconfig smb on chkconfig nmb on
#必要なパッケージをインストール yum install pam-devel readline-devel fileutils libacl-devel openldap-devel krb5-devel cups-devel keyutils-libs-devel # ソース展開 cd /usr/src/redhat wget http://ftp.samba.org/pub/samba/samba-3.6.25.tar.gz tar xvfz samba-3.6.25.tar.gz patch -p0 < samba-3.6.25.spec.patch # ビルド cd samba-3.6.25/packaging/RHEL bash makerpms.sh # インストール cd /usr/src/redhat/RPMS/x86_64/ rpm -ivh samba-3.6.25-1.C65.x86_64.rpm \ samba-client-3.6.25-1.C65.x86_64.rpm \ samba-common-3.6.25-1.C65.x86_64.rpm \ samba-doc-3.6.25-1.C65.x86_64.rpm # 起動 service smb restart chkconfig --add smb chkconfig smb on
yum update smb service smb restart
find . -perm 544 -exec chmod 644 {} \;
vi /etc/samba/smb.conf ---- [global] map archive = no ---- service smb restart