samba配置

由于工作需要,需要使用samba在windows下访问linux下的文件,主要是编译环境,linux下使用的是root用户,SSH登陆,而开发是在windows下,代码在windows下开发,为了开发的文件能方便共享,提高开发效率,就折腾了一下samba。

安装samba:yum install samba

开机启动:chkconfig smb on 

              chkconfig smb on

samba添加root用户访问:useradd root(默认已有)

smbpasswd -a root ---后面输入密码

 

配置samba:(主要配置)

[global]
	workgroup = SAMBA
	security = user

	passdb backend = tdbsam

	printing = cups
	printcap name = cups
	load printers = yes
	cups options = raw

[test]
	comment = Home Directories
	path=/home/test
	valid users = test,root
	writable = yes
        directory mask = 0775
        create mask = 0775
        valid users = test,root
        write list = test,root
        browseable = yes
        available = yes

[printers]
	comment = All Printers
	path = /var/tmp
	printable = Yes
	create mask = 0600
	browseable = No

[print$]
	comment = Printer Drivers
	path = /var/lib/samba/drivers
	write list = @printadmin root
	force group = @printadmin
	create mask = 0664
	directory mask = 0775

重启samba

service smb restart

windows下清除共享用户名和密码:net use * /delete

windows下访问共享:\\xx.xx.xx.xx\xx

linux下挂载使用命令:

mount.cifs  -o username="test",password="test",sec=ntlmssp  //172.28.107.2/test /opt/rh/

期间使用mount.cifs  -o username="test",password="test"  //172.28.107.2/home/test /opt/rh/有遇到如下问题:

 mount.cifs  -o domain="SAMBA",username="test",password="test",sec=ntlm  //172.28.107.6/home/test /opt/ -v
mount.cifs kernel mount options: ip=172.28.107.6,unc=\\172.28.107.6\home,sec=ntlm,ver=1,user=test,domain=SAMBA,prefixpath=test,pass=********
mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
[root@localhost home]# dmesg
Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE
CIFS VFS: Send error in SessSetup = -13
CIFS VFS: cifs_mount failed w/return code = -13

该问题主要是sec值不对导致,sec具体有

  sec=
       Security mode. Allowed values are:
       ·   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

       The default in mainline kernel versions prior to v3.8 was sec=ntlm. 
       In v3.8, the default was changed to sec=ntlmssp.

修改mount.cifs -o username="test",password="test",sec=ntlmssp //172.28.107.2/home/test /opt/rh/后又出现如下问题:

[root@localhost home]# mount.cifs  -o domain="SAMBA",username="test",password="test",sec=ntlmssp  //172.28.107.6/home/test /opt/ -v
mount.cifs kernel mount options: ip=172.28.107.6,unc=\\172.28.107.6\home,sec=ntlmssp,ver=1,user=test,domain=SAMBA,prefixpath=test,pass=********
Retrying with upper case share name
mount.cifs kernel mount options: ip=172.28.107.6,unc=\\172.28.107.6\HOME,sec=ntlmssp,ver=1,user=test,domain=SAMBA,prefixpath=TEST,pass=********
mount error(6): No such device or address
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
[root@localhost home]# dmesg
Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE
CIFS VFS: cifs_mount failed w/return code = -6

该问题主要是没有目录,该目非具体路径,而是samba配置的[test],修改为test后就可以了

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值