Setting up Samba services in Linux redhat6.5

Source: Internet
Author: User

Samba is a free software that implements the SMB protocol on Linux and UNIX systems, consisting of servers and client programs. SMB (Server Messages block, information service blocks) is a kind of communication protocol for sharing files and printers on LAN, which provides shared services of files and printers among different computers in LAN. The SMB protocol is a client/server protocol that allows clients to access shared file systems, printers, and other resources on the server. By setting up "NetBIOS over TCP/IP", Samba will not only share resources with local network hosts, but also share resources with computers around the world.

The following will build the Samba server in the Linux redhat6.5

需要用的安装包:samba1:安装    rpm -ivh /mnt/Packages/samba-3.6.9-164.el6.x86_64.rpm  //安装samba软件包    rpm -qc samba          //查看软件路径    cd /etc/samba/          //到samba目录下    mv smb.conf smb.conf.bak      //把smb.conf   移动重新命名为 smb.conf.bak    grep -v "#" smb.conf.bak > smb.conf     //过滤掉smb.con.bak文件中的#  另存为smb.conf    vi smb.conf      //编辑smb.conf

2: security = share    匿名用户的身份验证            [share]     path=/opt/abc          //路径     public=yes             //公共共享文件     browseable=yes         //能够访问     writable=yes          // 能写入     create mask=0644     directory mask=0755    //子文件权限


3:      mkdir /opt/abc                // 在opt目录下 创建abc            chmod 777 /opt/abc          //修改abc目录的权限            service iptables stop         // 关闭防火墙            setenforce 0                                service smb start             //开启smb 服务

4:在windows上搜索 \\192.168.100.111  进入samba共享服务    进入创建一个文件     回到linux /opt/abc 可以查看到该文件


5:下面给samba 设置身份验证登录vim /etc/samba/smb.confsecurity = user    身份验证[zkc]path=/opt/zkc                          //文件保存路径browseable=yes                    //能够访问create mask=0644              directory mask=0755             //子文件权限valid users=zzz, kkk        zzz  kkk 用户可以访问write list=zzz              zzz  可以写入



6:useradd zzz            //创建zzz用户      useradd kkk      smbpasswd -a zzz     //设置samba登录密码    smbpasswd -a kkk    pdbedit -L      //查看samba用户     mkdir /opt/zkc          //opt下面创建zkc目录     chmod 777 /opt/zkc/      //修改zkc目录权限

7:重启smb服务         清理windows缓存


8:现在再次打开samba 会跳出登录窗口 输入zzz   密码123456 确定进入samba共享文件



9:下面做samba 账户映射  虚拟帐号登录    cd /etc/samba/                   //到etc/samba    ls                                       //查看    vi smbusers                      //编辑smbusers    zzz = z01 z02                   //zzz用户等于 z01    z02


10:vi smb.conf             //编辑smb.confusername map = /etc/samba/smbusers         //添加改行 定义路径

11:使用z01 登录  就是进入zzz用户进入smb共享文件    创建一个z01.txt      然后去linux     查看文件属主    可以看到是zzz创建的



12:如何配置  拒绝访问smb服务vi /etc/samba/smb.conf      //编辑smb.conf hosts deny=192.168.100. 10.0.0.    //访问控制列表(拒绝访问)


Setting up Samba services in Linux redhat6.5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.