设置/etc/samba/smb.conf
netbios = your host name
workgroup = workgroup
security = user
username map = yes
1 添加系统帐号
# useradd hypoz
# useradd redhat
2 添加samba用户和密码
# smbpasswd hypoz
# smbpasswd redhat
3 为两个samba用户添加映射名,修改/etc/samba/userpasswd
hypoz = tom jack
redahat = home shift
4 建立要共享的目录
# mkdir /home/share/test1
# mkdir /home/share/test2
5 修改/etc/samba/smb.conf,添加共享目录
netbios = your host name
workgroup = workgroup
security = user
username map = yes
1 添加系统帐号
# useradd hypoz
# useradd redhat
2 添加samba用户和密码
# smbpasswd hypoz
# smbpasswd redhat
3 为两个samba用户添加映射名,修改/etc/samba/userpasswd
hypoz = tom jack
redahat = home shift
4 建立要共享的目录
# mkdir /home/share/test1
# mkdir /home/share/test2
5 修改/etc/samba/smb.conf,添加共享目录
6 修改/home/share/share/test1的文件所有权
# chown hypoz /home/share/test1
# chown hypoz /home/share/test1
注,此时宜hypoz,tom,jack登陆的用户可以修改/home/share/test1文件夹
注销后用redhat,home,shift登陆,只能对浏览/home/share/test1。
或者,可以修改该目录的用户组,并更改共享文件的属性
# chgrp hypoz /home/share/test1
# chamod g+w /home/share/test1
[share]
path = /home/share/test1
comment = for test.
public = no
valid users = hypoz redhat
write list = @hypoz
注销后用redhat,home,shift登陆,只能对浏览/home/share/test1。
或者,可以修改该目录的用户组,并更改共享文件的属性
# chgrp hypoz /home/share/test1
# chamod g+w /home/share/test1
[share]
path = /home/share/test1
comment = for test.
public = no
valid users = hypoz redhat
write list = @hypoz
即使文件所有权是redhat,hypoz所有的组用户都可以浏览并修改。
注:如果无意中安装了selinux,客户端访问你的samba服务器将不能顺利的读、写和执行。可以关闭selinux功能。
shell > vi /etc/selinux/config
将 SELINUX= disable,然后必须重新启动计算机。
对SELINUX不是很了解,只知道它是一个保护服务器服务及进程,防止用户因更改设置导致其他服务不能正常工作,包括php的安装都有保护。建议一次性将系统安装全,不要中途覆盖安装其他服务。
注:如果防火墙选择了关闭所有打开应用,SAMBA的端口号是139。