Redhat Samba服务配置

上一篇 / 下一篇  2010-07-08 16:32:49 / 个人分类:笔记

 

由于学习安装DB2软件(由于软件包存放在WINDOWS系统中),需要将DB2软件包拷贝到LINUX系统中,这时就需要建立LINUXWINDOWS系统文件共享,在这里采用SAMBA服务或MOUNT挂载的方式进行文件共享(当然也可以采用FTP其他方式)。

  SAMBA配置

在该部分中主要是配置smb.conf文件内容以及添加smb用户。smb.conf位于LINUX文件目录/etc/samba中。

首先我们添加SMB用户,SMB用户首先必须是系统用户:

######################################################################

[root@localhost samba]# useradd db2inst1    #增加系统用户

[root@localhost samba]# passwd db2inst1     #修改密码

Changing password for user db2inst1.

New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

[root@localhost samba]# smbpasswd -a db2inst1  #增加SMB用户

New SMB password:

Retype new SMB password:

startsmbfilepwent_internal: file /etc/samba/smbpasswd did not exist. File successfully created.

Added user db2inst1.

####################################################################

第二、创建需要共享的文件夹

####################################################################

[root@localhost mnt]#mkdir samba_share

[root@localhost samba]# ls /mnt

samba_share

[root@localhost samba]# chown nobody.nobody /mnt/samba_share #设置权限

####################################################################

第三、设置smb.conf

####################################################################

[root@localhost samba]# vi smb.conf

[global]

# workgroup = NT-Domain-Name or Workgroup-Name

  workgroup = MYGROUP   #定义工作

 

# server string is the equivalent of the NT Description field

  server string = Samba Server                 #服务器名

 

# This option is important for security. It allows you to restrict

# connections to machines which are on your local network. The

# following example restricts access to two C class networks and

# the "loopback" interface. For more examples of the syntax see

# the smb.conf man page

#;  hosts allow = 192.168.1. 192.168.2. 127.

    hosts allow = 172.20.50. 172.20.30.    

#设置允许访问的网络段,这里是允许3050段的IP访问

……………………….(其他省略)

[samba_share]                  #共享文件

    comment = liutao's and db2inst1's 

    path = /mnt/samba_share   #路径

    valid users = liutao db2inst1     #用户

    public = no             

    writable = yes                #是否可写

    printable = no

#######################################################################

第四、Samba测试

[root@localhost mnt]#testparm

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

Processing section "[homes]"

Processing section "[printers]"

Processing section "[samba_share]"

Loaded services file OK.

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters

[global]

       workgroup = MYGROUP

       server string = Samba Server

       log file = /var/log/samba/%m.log

       max log size = 50

       socket ptions = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

       printcap name = /etc/printcap

       dns proxy = No

       idmap uid = 16777216-33554431

       idmap gid = 16777216-33554431

       hosts allow = 172.20.50., 172.20.30.

       cups ptions = raw

 

[homes]

       comment = Home Directories

       read nly = No

       browseable = No

 

[printers]

       comment = All Printers

       path = /var/spool/samba

       printable = Yes

       browseable = No

 

[samba_share]

       comment = liutao's and db2inst1's

       path = /mnt/samba_share

       valid users = liutao, db2inst1

       read nly = No

       guest k = Yes

重新启动SMB服务:

[root@localhost samba]#service smb restart

Shutting down SMB services: [ OK ]

Shutting down NMB services: [ OK ]

Starting SMB services: [ OK ]

Starting NMB services: [ OK ]

WINDOWS系统共享进行访问共享目录://172.20.50.133

LINUX系统文件共享(访问主机也需要安装有SAMBA):

#####################################################################

[root@localhost mnt]# smbclient //172.20.50.79/myshare -U db2inst1

Password:

Domain=[D0736] S=[Unix] Server=[Samba 3.0.10-1.4E.6]

smb: \> pwd

Current directory is \\172.20.50.79\myshare\

smb: \> ls

 .                                  D       0 Mon Apr 26 15:42:53 2010

smb: \>

smb:\>get file    #get可以将服务器共享目录中的指定文件下载

smb:\>put file    #将文件上传到samba服务器中

 

[root@root/]#smbstatus #显示当前主机中的samba服务器的连接状态信息

[root@root/]#smbmount//172.20.50.79/myshare /mnt #172.20.50.79/myshare目录挂载到本地目录/mnt

[root@root/]#umount/mnt    #卸载共享目录

#####################################################################

 


TAG:

 

评分:0

我来说两句

日历

« 2024-03-23  
     12
3456789
10111213141516
17181920212223
24252627282930
31      

数据统计

  • 访问量: 6528
  • 日志数: 14
  • 建立时间: 2010-07-03
  • 更新时间: 2015-04-29

RSS订阅

Open Toolbar