背景:
阅读新闻
Linux下Samba服务器在企业网络中应用
[日期:2012-05-06] 来源:Linux社区 作者:xjzhujunjie [字体:]
4. Samba服务器配置案例:
samba安装:
[root@ ~]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@ ~]# rpm -qa |grep samba
samba-common-3.0.33-3.7.el5
samba-client-3.0.33-3.7.el5
[root@ ~]# cd /mnt/cdrom/Server/
[root@ Server]# ls samba*
samba-3.0.33-3.14.el5.i386.rpm
samba-client-3.0.33-3.14.el5.i386.rpm
samba-common-3.0.33-3.14.el5.i386.rpm
samba-swat-3.0.33-3.14.el5.i386.rpm
[root@ Server]# rpm -ivh samba-3.0.33-3.14.el5.i386.rpm
error: Failed dependencies:
perl(Convert::ASN1) is needed by samba-3.0.33-3.14.el5.i386
samba-common = 0:3.0.33-3.14.el5 is needed by samba-3.0.33-3.14.el5.i386
[root@ Server]# yum install -y samba samba-swat
Installed: samba.i386 0:3.0.33-3.14.el5 samba-swat.i386 0:3.0.33-3.14.el5
Dependency Installed: perl-Convert-ASN1.noarch 0:0.20-1.1
Updated: samba-client.i386 0:3.0.33-3.14.el5 samba-common.i386 0:3.0.33-3.14.el5
Complete!
[root@ ~]# useradd user1
[root@ ~]# useradd user2
[root@ ~]# echo "123" |passwd --stdin user1
Changing password for user user1.
passwd: all authentication tokens updated successfully.
[root@ ~]# echo "123" |passwd --stdin user2
Changing password for user user2.
passwd: all authentication tokens updated successfully.
[root@ ~]# smbpasswd -a user1
New SMB password:
Retype new SMB password:
Added user user1.
[root@ ~]# smbpasswd -a user2
New SMB password:
Retype new SMB password:
Added user user2.
[root@ ~]# mkdir /public
[root@ ~]# touch /public/p1
[root@ ~]# mkdir /soft
[root@ ~]# touch /soft/f1
[root@ ~]# mkdir /smbuser2
[root@ ~]# touch /smbuser2/f1.user2
[root@ ~]# chmod 777 /public/ /soft/ /smbuser2/
[root@ ~]# ll -d /public/ /soft/ /smbuser2/
drwxrwxrwx 2 root root 4096 Apr 15 18:03 /public/
drwxrwxrwx 2 root root 4096 Apr 15 18:12 /smbuser2/
drwxrwxrwx 2 root root 4096 Apr 15 18:04 /soft/
[root@ ~]# vim /etc/samba/smb.conf
89 log file = /var/log/samba/%m.log
91 max log size = 50
101 security = user
289 [public]
290 comment = this public dir
291 path = /public
292 public = yes
293 [smb-user1]
294 comment = this user1's dir
295 path = /soft
296 valid users = user1
297 writable = yes
298 [smb-user2]
299 comment = this user2's dir
300 path = /smbuser2
301 valid users = user2
303 writable = yes
#检查语法:
[root@ ~]# testparm
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[public]"
Processing section "[smb-user1]"
Processing section "[smb-user2]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
passdb backend = tdbsam
log file = /var/log/samba/%m.log
max log size = 50
cups options = raw
[homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
printable = Yes
browseable = No
[public]
comment = this public dir
path = /public
guest ok = Yes
[smb-user1]
comment = this user1's dir
path = /soft
valid users = user1
read only = No
[smb-user2]
comment = this user2's dir
path = /smbuser2
valid users = user2
read only = No
#重启samba的服务smb
[root@ ~]# service smb restart
Shutting down SMB services: [ OK ]
Shutting down NMB services: [ OK ]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
#user1登录测试
使用命令关闭user1的连接,接下来使用user2访问测试!
#user2登录测试
Ubuntu Server 10.04 升级到 12.04 LTS版
在Linux下搭建HA和LB集群(LVS&Heartbeat群集)
相关资讯
本文评论 查看全部评论 (0)
尊重网上道德,遵守中华人民共和国的各项有关法律法规 承担一切因您的行为而直接或间接导致的民事或刑事法律责任 本站管理人员有权保留或删除其管辖留言中的任意内容 本站有权在网站内转载或引用您的评论 参与本评论即表明您已经阅读并接受上述条款
评论声明
最新资讯