快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

samba服务器怎么安装

这篇文章主要介绍“samba服务器怎么安装”,在日常操作中,相信很多人在samba服务器怎么安装问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”samba服务器怎么安装”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

我们注重客户提出的每个要求,我们充分考虑每一个细节,我们积极的做好成都网站建设、网站制作服务,我们努力开拓更好的视野,通过不懈的努力,成都创新互联公司赢得了业内的良好声誉,这一切,也不断的激励着我们更好的服务客户。 主要业务:网站建设,网站制作,网站设计,微信小程序,网站开发,技术开发实力,DIV+CSS,PHP及ASP,ASP.Net,SQL数据库的技术开发工程师。

一,安装软件

[root@station10 ~]# yum install -y samba samba-common samba-client system-config-samba

查看安装的软件

[root@station10 ~]# rpm -aq | grep samba

samba-3.0.25b-0.el5.4

system-config-samba-1.2.39-1.el5

samba-client-3.0.25b-0.el5.4

samba-common-3.0.25b-0.el5.4

[root@station10 ~]#

[@more@]

二,配置samba,方法有如下三种

1,system-config-samba

2,samba-swat(http://localhost:901)

3, 编辑 smb.conf 文件

三,通过第3中方法配置samba

1, 建立一个共享的文件夹

[root@station10 /]# mkdir /backup

[root@station10 /]# chmod 777 -R /backup

2,在/etc/samba/smb.conf末尾添加:

[backup]

comment = backup

path = /backup

writeable = yes

public = yes

printable = no

3,添加samba用户

[root@station10 /]# smbpasswd -a root

New SMB password:

Retype new SMB password:

[root@station10 /]# smbpasswd -a back

New SMB password:

Retype new SMB password:

[root@station10 /]#

4,测试语法

[root@station10 /]# testparm /etc/samba/smb.conf

Load smb config files from /etc/samba/smb.conf

Processing section "[homes]"

Processing section "[printers]"

Processing section "[backup]"

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

cups options = raw

[homes]

comment = Home Directories

read only = No

browseable = No

[printers]

comment = All Printers

path = /var/spool/samba

printable = Yes

browseable = No

[backup]

comment = backup

path = /backup

read only = No

guest ok = Yes

[root@station10 /]# testparm /etc/samba/smb.conf station10.example.com 192.168.0.10

Load smb config files from /etc/samba/smb.conf

Processing section "[homes]"

Processing section "[printers]"

Processing section "[backup]"

Loaded services file OK.

Server role: ROLE_STANDALONE

Allow connection from station10.example.com (192.168.0.10) to homes

Allow connection from station10.example.com (192.168.0.10) to printers

Allow connection from station10.example.com (192.168.0.10) to backup

[root@station10 /]#

5,启动samba

[root@station10 /]# /etc/init.d/smb start

Starting SMB services: [ OK ]

Starting NMB services: [ OK ]

[root@station10 /]#

6, 在另外一台机器上测试

[root@station12 ~]# smbclient -L station10 -U 'back%redhat'

Domain=[STATION10] OS=[Unix] Server=[Samba 3.0.25b-0.el5.4]

Sharename Type Comment

--------- ---- -------

backup Disk backup

IPC$ IPC IPC Service (Samba Server Version 3.0.25b-0.el5.4)

back Disk Home Directories

Domain=[STATION10] OS=[Unix] Server=[Samba 3.0.25b-0.el5.4]

Server Comment

--------- -------

Workgroup Master

--------- -------

MYGROUP

[root@station12 ~]#

7,建立文件夹的时候出错

[root@station12 ~]# smbclient -U 'back%redhat' //station10/backup

Domain=[STATION10] OS=[Unix] Server=[Samba 3.0.25b-0.el5.4]

smb: > ls

. D 0 Fri Oct 17 18:36:04 2008

.. D 0 Fri Oct 17 18:36:05 2008

63483 blocks of size 65536. 17042 blocks available

smb: > mkdir test

NT_STATUS_ACCESS_DENIED making remote directory test

smb: >

8,查看selinux对应的策略

# SELINUX NOTES:

#

# If you want to use the useradd/groupadd family of binaries please run:

# setsebool -P samba_domain_controller on

#

# If you want to share home directories via samba please run:

# setsebool -P samba_enable_home_dirs on

#

# If you create a new directory you want to share you should mark it as

# "samba-share_t" so that selinux will let you write into it.

# Make sure not to do that on system directories as they may already have

# been marked with othe SELinux labels.

#

# Use ls -ldZ /path to see which context a directory has

#

# Set labels only on directories you created!

# To set a label use the following: chcon -t samba_share_t /path

#

# If you need to share a system created directory you can use one of the

# following (read-only/read-write):

# setsebool -P samba_export_all_ro on

# or

# setsebool -P samba_export_all_rw on

#

# If you want to run scripts (preexec/root prexec/print command/...) please

# put them into the /var/lib/samba/scripts directory so that smbd will be

# allowed to run them.

# Make sure you COPY them and not MOVE them so that the right SELinux context

# is applied, to check all is ok use restorecon -R -v /var/lib/samba/scripts

#

#--------------

9,更改selinux的策略

[root@station10 /]# chcon -t samba_share_t /backup

[root@station10 /]# /etc/init.d/smb restart

Shutting down SMB services: [ OK ]

Shutting down NMB services: [ OK ]

Starting SMB services: [ OK ]

Starting NMB services: [ OK ]

[root@station10 /]#

10,继续建立文件夹测试ok:

[root@station12 ~]# smbclient -U 'back%redhat' //station10/backup

Domain=[STATION10] OS=[Unix] Server=[Samba 3.0.25b-0.el5.4]

smb: > mkdir test

smb: > ls

. D 0 Fri Oct 17 18:44:36 2008

.. D 0 Fri Oct 17 18:36:05 2008

test D 0 Fri Oct 17 18:44:36 2008

63483 blocks of size 65536. 17042 blocks available

smb: >

11,设置简单共享

更改配置文件security 为 share

security = share

重启samba服务

[root@station10 ~]# /etc/init.d/smb restart

测试:

[root@station10 ~]# smbclient //station10/backup

Password:

Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.0.25b-0.el5.4]

Server not using user level security and no password supplied.

smb: >

四,samba Client Tools: nmblookup

list specific machine

nmblookup -U WINS_server -R name

list all machines

nblookup *

[root@station12 ~]# nmblookup *

querying * on 192.168.0.255

192.168.0.10 *<00>

192.168.0.12 *<00>

[root@station12 ~]#

五,samba Clients Tools:mounts

The SMB and CIFS file systems are supported by the Linux Kernel

use mount to mount a Samba-shared resource:

mount -t cifs service mountpoing -o option1,option2

例子:

[root@station12 ~]# mount -t cifs //station10/backup /mnt -o username=back

Password:

[root@station12 ~]# mount

/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

/dev/mapper/VolGroup00-LogVol01 on /home type ext3 (rw)

/dev/sda1 on /boot type ext3 (rw)

tmpfs on /dev/shm type tmpfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

//station10/backup on /mnt type cifs (rw,mand)

[root@station12 ~]#

或者把root用户加入到samba用户

[root@station12 ~]# smbpasswd -a root

New SMB password:

Retype new SMB password:

Added user root.

[root@station12 ~]#

[root@station12 ~]# mount -t cifs //station10/backup /mnt

Password:

[root@station12 ~]# mount

/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

/dev/mapper/VolGroup00-LogVol01 on /home type ext3 (rw)

/dev/sda1 on /boot type ext3 (rw)

tmpfs on /dev/shm type tmpfs (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

//station10/backup on /mnt type cifs (rw,mand)

[root@station12 ~]#

到此,关于“samba服务器怎么安装”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注创新互联网站,小编会继续努力为大家带来更多实用的文章!


文章题目:samba服务器怎么安装
新闻来源:http://6mz.cn/article/goosej.html

其他资讯