samba.set
1. # useradd aaa
# passwd aaa
# smbpasswd -a aaa
# vim /etc/samba/smbusers
添加 aaa = a ,smbusers 文件内容如下:
# Unix_name = SMB_name1 SMB_name2 ...
root = administrator admin
nobody = guest pcguest smbguest
ztg = ztguang
aaa = a
2. smb.conf 文件中的部分内容如下:
[share]
comment = tmp share
path = /share
writeable = yes
; browseable = yes
valid users = ztg
3. # mkdir /share/
4. # chmod -R 777 /share/
5. # chcon -R -t public_content_rw_t /share/
6. # iptables -F
7. 如果是 /home , 还要执行如下命令:
[root@localhost ~]# getsebool -a|grep samba
samba_domain_controller --> off
samba_enable_home_dirs --> off
samba_export_all_ro --> off
samba_export_all_rw --> off
samba_share_nfs --> off
use_samba_home_dirs --> off
virt_use_samba --> off
[root@localhost ~]# setsebool samba_enable_home_dirs 1
[root@localhost ~]# setsebool samba_enable_home_dirs on
# rpm -Uvh Desktop/selinux-policy-devel-2.4.6-255.el5.noarch.rpm
# rpm -Uvh Desktop/policycoreutils-gui-1.33.12-12.el5.i386.rpm
# system-config-selinux
注意:windows 访问 samba 的共享资源时,需要将 smb.conf 文件中的
; netbios name = MYSERVER
取消注释
注意:如果一切设置正确,windows 仍然无法访问 samba 的共享资源时,要考虑“计算机名”重名的问题(因为局域网的电脑是网络传系统,设置起初都一样)。
+++++++++++++++++++++++++++++
下面练习 smbclient 命令
[root@localhost ~]# smbclient //192.168.1.81/share -U administrator
[root@localhost ~]# smbclient -L 192.168.1.86
Password:
Anonymous login successful
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.0.33-3.14.el5]
Sharename Type Comment
--------- ---- -------
homes Disk Home Directories
dajia Disk
liuxianzhong Disk haha
root directory Disk
home Disk share
IPC$ IPC IPC Service (Samba Server Version 3.0.33-3.14.el5)
Anonymous login successful
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.0.33-3.14.el5]
Server Comment
--------- -------
LOCALHOST Samba Server Version 3.0.33-3.14.el5
MYSERVER Samba Server Version 3.0.33-3.14.el5
Workgroup Master
--------- -------
MYGROUP LOCALHOST
[root@localhost ~]# smbclient //192.168.1.86/dajia
Password:
Anonymous login successful
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.0.33-3.14.el5]
smb: \> dir
. D 0 Tue Jan 1 00:47:04 2002
.. D 0 Tue Jan 1 05:11:26 2002
大家好 0 Tue Jan 1 00:46:28 2002
38752 blocks of size 262144. 21643 blocks available
smb: \> mkdir nihao
NT_STATUS_ACCESS_DENIED making remote directory \nihao
smb: \>
+++++++++++++++++++++++++++++
下面的命令大家不用看
第1步: # chcon -R -t public_content_rw_t /home/ztg/
第2步: # chcon -R -t samba_share_t /var/log/samba/
第3步: # iptables -F
第4步: # rpm -Uvh Desktop/policycoreutils-gui-1.33.12-12.el5.i386.rpm
第5步: # system-config-selinux
# cp /media/CentOS_5.1_Final/CentOS/policycoreutils-gui-1.33.12-12.el5.i386.rpm Desktop/
阅读(522) | 评论(0) | 转发(0) |