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就可以访问了