目录

Samba Server

Samba是在Linux和UNIX系统上实现SMB协议的一个免费软件,C/S架构,可用于用于Linux和Windows共享文件。SMB(Server Messages Block,信息服务块)是一种在局域网上共享文件和打印机的一种通信协议,它为局域网内的不同计算机之间提供文件及打印机等资源的共享服务。客户机通过该协议可以访问服务器上的共享文件系统、打印机及其他资源。通过设置”NetBIOS over TCP/IP”使得Samba不但能与局域网络主机分享资源,还能与全世界的电脑分享资源。

Samba:File share service(windows <–> linux),support edit(on-line) file’s content.Can be prevent the infection virus on windows OS.

You can setup the Samba server on Window or Linux.

Linux OS:

Protocol:SMB(Server message Block) Protocol

Port:TCP139 UDP137

Window OS:

Protocol:CIFS(Common Internet File System) Protocol

Port: TCP445 UDP138

Parameter

Program: smbd(Commonly used)\umdbd(Rarely used)

Software:

samba-3.033-3.28.el5

samba-common

samba-client(Web GUI management samba service,Rarely used)

configure file:

/etc/samba/smb.conf

Tools for Check configure:testparm

Configuration file explain

Vim /etc/samba/smb.conf

#Section:
[global] #Global Setting
workgroup = #work group name
security = [share|user|server] #select one out of three
#share --> don't need the authentication
#user --> login the samba server share directory by local samba user authentication
#server --> user authentication by network
log file = #log file store url [homes] #share /home directory [printers] #Printers set [userShare] #user-defined share directory
comment = #description of share directory
path = #share directory path
browseable = [yes|no] #samba service share directory whether show in the Network Neighborhood of windows OS.General the value is "yes"
guest ok = [yes|no] #share directory whether can access by anonymous user
#yes --> support anonymous user access
#no --> access by authentication
valid users = userName,@groupName #Allow user who can login share directory
writable = [yes|no] #User whether have permission to write in the share directory
write list = userName,@groupName #Allow user who have write permission in the share directory
public = [yes|no] #whether support anonymous user to login the share directory
create mode = 0644 #Set the default permissions of file when you create a new file in the share directory
directory mode = 0755 #Set the default permissions of directory when you create a new sub-directory in the share directory
#Attention: If you want to write into the share directory, you have to meet two condition.
# 1.Set option "writable = yes" into the config file
# 2.The share directory have permissions of writable(rw-rw-rw-)

Check samba config file:

1.Use command grep:

grep -V "^#" smb.conf | grep -V "^;" | grep -V ^$

2.Use command supported by samba service

testparm  #Check and read the config file

Setup the Samba Server

Step1. Install samba and check the config file

yum in stall -y samba samba-common samba-client
grep -V "^#" /etc/samba/samba.conf | grep -V "^;" | grep -V ^$ #Look up the configuration file
testparm

Step2. Edit samba service config file.

vim /etc/samba/smb.conf

#Example:
[global]
security = user
hosts allow = 127. 192.168.8. 10.20.0. #limit access from IP address, Only allow access from network-segment with (127./192.168.8./10.20.0.)
hosts deny = 172.16.8. #Deny every access from 172.16.8.
[myshare]
comment = Jmilk share driectory
path = /tmp/myshare #share dir with /tmp/myshare
browseable = yes
guest ok = no
valid users = jmilk,@jmilkGroup
writable = yes
write list = jmilk,@jmilkGroup
create mode = 0644
public = no
directory mode = 0755

**Step3.**change the permission for share directory

chmod 757 /tmp/myshare     #ensure the share directory have writable permissions

Step4. Create samba user in local, and setting not support login the OS for samba user.

Precondition:samba userName have to the same as OS userName.

useradd -M -s /sbin/nologin jsamba
pdbedit -a -u jsamba
#-a create
#-u userName
smbpasswd jsamba #change the password for samba user
pdbedit -Lv jsamba #list samba user detailed info

Step4. Start samba service

service smbd restart

Access the samba shareDirectory from other linux OS

Samba Server:Linux

Samba Client:Linux

Step1. List the share directory

smbclient -L SambaServerIP

Step2. Login the samba server’s share directory

1.Anonymous user login

smbclient //sambaServerIP/shareDirectoryName
#get --> download the file into local from samba server.
#put --> upload the file into samba server from local

2.Samba user authentication login

smbclient //sambaServerIP/shareDirectoryName -u sambaUserName
mount -o userName=jsamba,passwd fanguiju //sambaServerIP/shareDirectory /mnt

Access the windows OS samba shareDirectory from Linux

**Samba Server**Windows

Samba Client:Linux

Step1.

smbclient -L sambaServerIP -u administrator   #login sambaServer(win) by adminstrator identity
smbclient -u administrator //sambaServerIP

step2. Mount share dirctory into local

mount -o userName=administrator //sambaServerIP(wim)/d$ /mnt/winShare

vim /etc/fstab #realize permanent mount

Attention:在同一个可以互通的网络中,只要有一台SambaSrever,那受到此SambaServer影响的LinuxOS和windowsOS都可以实现与sambaServer之间实现文件共享。

Access the samba shareDirectory of LinuxOS by winOS

**Server:**Linux

**Client:**Windows

Ctrl+R(run) //LinuxSambaServerIP #And then enter the user authentication

CMD.exe command below:

net use * /del /y   #clear the user login cache

Linux_Samba详解的更多相关文章

  1. Linq之旅:Linq入门详解(Linq to Objects)

    示例代码下载:Linq之旅:Linq入门详解(Linq to Objects) 本博文详细介绍 .NET 3.5 中引入的重要功能:Language Integrated Query(LINQ,语言集 ...

  2. 架构设计:远程调用服务架构设计及zookeeper技术详解(下篇)

    一.下篇开头的废话 终于开写下篇了,这也是我写远程调用框架的第三篇文章,前两篇都被博客园作为[编辑推荐]的文章,很兴奋哦,嘿嘿~~~~,本人是个很臭美的人,一定得要截图为证: 今天是2014年的第一天 ...

  3. EntityFramework Core 1.1 Add、Attach、Update、Remove方法如何高效使用详解

    前言 我比较喜欢安静,大概和我喜欢研究和琢磨技术原因相关吧,刚好到了元旦节,这几天可以好好学习下EF Core,同时在项目当中用到EF Core,借此机会给予比较深入的理解,这里我们只讲解和EF 6. ...

  4. Java 字符串格式化详解

    Java 字符串格式化详解 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 文中如有纰漏,欢迎大家留言指出. 在 Java 的 String 类中,可以使用 format() 方法 ...

  5. Android Notification 详解(一)——基本操作

    Android Notification 详解(一)--基本操作 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 源码:AndroidDemo/Notification 文中如有纰 ...

  6. Android Notification 详解——基本操作

    Android Notification 详解 版权声明:本文为博主原创文章,未经博主允许不得转载. 前几天项目中有用到 Android 通知相关的内容,索性把 Android Notificatio ...

  7. Git初探--笔记整理和Git命令详解

    几个重要的概念 首先先明确几个概念: WorkPlace : 工作区 Index: 暂存区 Repository: 本地仓库/版本库 Remote: 远程仓库 当在Remote(如Github)上面c ...

  8. Drawable实战解析:Android XML shape 标签使用详解(apk瘦身,减少内存好帮手)

    Android XML shape 标签使用详解   一个android开发者肯定懂得使用 xml 定义一个 Drawable,比如定义一个 rect 或者 circle 作为一个 View 的背景. ...

  9. Node.js npm 详解

    一.npm简介 安装npm请阅读我之前的文章Hello Node中npm安装那一部分,不过只介绍了linux平台,如果是其它平台,有前辈写了更加详细的介绍. npm的全称:Node Package M ...

随机推荐

  1. ECharts 中的事件和行为

    在 ECharts 的图表中用户的操作将会触发相应的事件.开发者可以监听这些事件,然后通过回调函数做相应的处理,比如跳转到一个地址,或者弹出对话框,或者做数据下钻等等. 如下是一个绑定点击操作的示例. ...

  2. hadoop最简伪分布式安装

    本次安装运行过程使用的是Ubuntu16.04 64位+Hadoop2.5.2+jdk1.7.0_75 Notice: Hadoop2.5.2版本默认只支持64位系统 使用的jdk可以为1.7和1.8 ...

  3. git 与gitlab

    1.gitlab 创建project ,命名为test2 2.git push项目 git remote add ******* mkdir test1 cd test1 git init nano ...

  4. jquery 查找元素,并判断隐藏或显示

    html <div class="panel-heading"> <h4 class="panel-title"> <a data ...

  5. Kendo UI使用教程:入门指南

    [Kendo UI最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support for React和 ...

  6. bio,nio,aio的区别 select,poll,epoll的区别

    先了解一些基本概念,什么是socket?什么是I/O操作 unix(like)世界里,一切皆文件,而文件是什么呢?文件就是一串二进制流而已,不管socket,还是FIFO.管道.终端,对我们来说,一切 ...

  7. MegaPixImage插件代码(new MegaPixImage)

    /** * Mega pixel image rendering library for iOS6 Safari * * Fixes iOS6 Safari's image file renderin ...

  8. pymysql ,主键, 索引

    目录 一.pymysql模块的使用 1. 安装pymysql 2. 连接MySQL 3. sql注入问题 二.索引 1. 什么是索引 2. 索引有什么用 3. 索引的底层原理 4. 主键 5. MyS ...

  9. Linux系统如何选择MongoDB版本

    mogodb各个版本该怎么选: 如下图所示,我们可以看到有许多版本的安装包,那我们选择下载哪个呢?下面我会讲解一下: 我们发现主要有6种,分别是 : Amazon Linux(亚马逊). Debian ...

  10. 箱排序(Bin Sort)

    1.基本思想 排序过程无须比较关键字,而是通过"分配"和"收集"过程来实现排序.它们的时间复杂度可达到线性阶:O(n). 箱排序也称桶排序(Bucket Sor ...