测试环境目前是samba服务器端是linux操作系统,客户端是linux和windows
1、服务器端samba的安装
yum install samba
2、修改/etc/smb.conf
全局配置 Global Settings workgroup = WORKGROUP server string = Samba Server Version %v netbios name = test 自定义区 Share Definitions [test] comment = test comment,#随便写,应该是个提醒而已 path = /home/test/samba,#具体目录,记住要有权限,否则无法读写 public = yes writable = yes printable = no write list = +staff,#记住要新建一个这样的组
3、其他自定义的用法,参考配置文件即可,一般第三种用的最多
# Un-comment the following and create the netlogon directory for Domain Logons ; [netlogon] ; comment = Network Logon Service ; path = /var/lib/samba/netlogon ; guest ok = yes ; writable = no ; share modes = no # Un-comment the following to provide a specific roving profile share # the default is to use the user's home directory ; [Profiles] ; path = /var/lib/samba/profiles ; browseable = no ; guest ok = yes # A publicly accessible directory, but read only, except for people in # the "staff" group ; [public] ; comment = Public Stuff ; path = /home/samba ; public = yes ; writable = yes ; printable = no ; write list = +staff
4、配置组、用户、家目录及samba自启动
groupadd staff
useradd -g staff test
passwd test
smbpasswd -a test,#这个密码才是samba客户端登录时用的
mkdir /home/test/samba
chown -R test:staff /home/test/samba
chkconfig sbm on
service sbm start
5、windows\linux客户端测试
windows下输入\\ip\test,提示输入用户名和密码,测试上传、下载、删除都OK
linux下安装yum install cifs-utils后(否则会提示只读错误),输:
mount //192.168.180.68/test /mnt/test -o username=test%518518
其他写法
mount -t cifs -o username=root,password=root01 //192.168.1.184/production /home/netrec
测试上传、下载、删除都OK
系统自动挂载的话,找到/etc/fstab添加即可:
//192.168.180.68/test /mnt/test cifs defaults,username=test,password=518518 0 0
转载于:https://blog.51cto.com/481814/1728334