liunx去訪問win系統的貢獻文件
smbclient
-L NetBIOS_NAME 主機名
-U username 用戶名
[root@localhost ~]# smbclient //192.168.1.100/test -U user
smb: \> help
? allinfo altname archive blocksize
cancel case_sensitive cd chmod chown
close del dir du echo
exit get getfacl geteas hardlink
help history iosize lcd link
lock lowercase ls l mask
md mget mkdir more mput
newer open posix posix_encrypt posix_open
posix_mkdir posix_rmdir posix_unlink print prompt
put pwd q queue quit
readlink rd recurse reget rename
reput rm rmdir showacls setea
setmode stat symlink tar tarmode
timeout translate unlock volume vuid
wdel logon listconnect showconnect ..
!
smb: \>
-------------------
smb: \> lcd /tmp 進入本地目錄的/tmp
smb: \> !pwd
/tmp
smb: \> !ls
smb yum.log yum_save_tx-2016-08-06-09-31gjLcvI.yumtx
smb: \> mput yum.log yum_save_tx-2016-08-06-09-31gjLcvI.yumtx
-------------------
掛在win系統上的共享文件到linux上
[root@localhost /]# mount -t cifs //192.168.1.100/test /mnt/test -o username=user
解決掛在出現這個問題:
mount: block device //192.168.1.100/test is write-protected, mounting read-only
mount: cannot mount block device //192.168.1.100/test read-only
解決方法:
[root@localhost tmp]# yum -y install cifs*
實現開機自動掛載
vim /etc/fstab
//192.168.1.100 /mnt cifs credential=/etc/samba/cred.passwd 0 0
vim /etc/samba/cred.passwd
username=user
password=user
chmod og=--- /etc/samba/cred.passwd
chown root.root /etc/samba/cred.passwd
新建一個共享,讓組mygrp的用戶有所有權限。 其他用戶只有讀權限
[ ]
comment =
path =
guest ok = yes
write list = @mygrp
samba:基於IP的訪問控制
iptables:
TCP 139,445
UDP 137, 138
[root@localhost ~]# vim /etc/samba/smb.conf
hosts allow = 127. 192.168.12. 192.168.13. 白名單
samba-swat 基於web GUI
[root@localhost ~]# yum -y install samba-swat
[root@localhost ~]# service xinetd start
[root@localhost ~]# chkconfig swat on 瞬時守護進程沒有級別
[root@localhost ~]# service xinetd restart
tcp 0 0 :::901 ::: LISTEN 1818/xinetd
每一個非獨立守護進程都有一個文件
[root@localhost ~]# cd /etc/xinetd.d/
[root@localhost xinetd.d]# ls
chargen-dgram daytime-stream echo-dgram swat time-stream
chargen-stream discard-dgram echo-stream tcpmux-server
daytime-dgram discard-stream rsync time-dgram
[root@localhost xinetd.d]#
[root@localhost xinetd.d]# vim swat
service swat
{
disable = no 是否禁用
port = 901
socket_type = stream TCP協議
wait = no 是否可以2個以上的用戶同時訪問
only_from = 127.0.0.1 192.168.1.100 白名單
user = root 以root的身份來運行服務
server = /usr/sbin/swat 指定程序
log_on_failure += USERID 差生錯誤的時候將用戶ID號記錄下來
}
然後在瀏覽器裏直接輸入192.168.1.50服務器ip就可以訪問了