yum -y install samba samba-client samba-swat

/etc/init.d/smb start

 chkconfig --level 35 smb on  

 cp -p /etc/samba/smb.conf    /etc/samba/smb.conf.orig

 vim /etc/samba/smb.conf



# logs split per machine
log file = /var/log/samba/%m.log
# max 50KB per log file, then rotate
; max log size = 50

# ----------------------- Standalone Server Options ------------------------
#
# Security can be set to user, share(deprecated) or server(deprecated)
#
# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration.

security = share
passdb backend = tdbsam
[public]
comment = Public Stuff
path = /samba
public = yes
writable = yes


 

 service sam restart

 service sab restart

 testpara

 

window客户端访问

在网络位置中,右键添加一个一个网络位置,添加网络例如\\192.168.161.132\public

 

还需要添加账户登录

​​如何添加Samba用户​​

Window系统连上我们的开发机Linux,自然需要在Samba里添加一个新用户。


linux-06bq:/usr/local/services/samba/bin # ./smbpasswd -a sunjing

New SMB password:

Retype new SMB password:

Failed to add entry for user sunjing.


百度给出的结论是”添加的Samba用户首先必须是Linux用户”,一下子豁朗开郎。


linux-06bq:/etc/samba # useradd sunjing

linux-06bq:/usr/local/services/samba/bin # ./smbpasswd -a sunjing

New SMB password:

Retype new SMB password:

Added user sunjing.


接下来在Windows机器上【控制面板】→【凭证管理器】中添加Windows凭证:


网络地址:xxx.xxx.xxx.xxx(即需要连接的Linux开发机的IP)

用户名:sunjing

密码:给Samba添加sunjing用户时设置的密码


最后,在【资源管理器】里直接【映射网络驱动器】,连上开发机即可。


smbpasswd命令的常用方法


smbpasswd -a 增加用户(要增加的用户必须以是系统用户)

smbpasswd -d 冻结用户,就是这个用户不能在登录了

smbpasswd -e 恢复用户,解冻用户,让冻结的用户可以在使用

smbpasswd -n 把用户的密码设置成空.

             要在global中写入 null passwords -true

smbpasswd -x  删除用户