Linux服务器---安装samba

简介:
安装samba
1、检测samba是否安装,如果没有,那么可以使用yum来安装。至少需要安装3个软件:samba, samba-client、samba-common
      [root@localhost pub]#  rpm -qa | grep samba
      samba-winbind-clients-3.6.9-164.el6.i686
      samba-client-3.6.9-164.el6.i686
      samba-common-3.6.9-164.el6.i686
      samba4-libs-4.0.0-58.el6.rc4.i686
      samba-winbind-3.6.9-164.el6.i686
      [root@localhost pub]#  yum install –y samba samba-client samba-common    //如果没有,那么可以用此命令安装

2、创建共享目录
      [root@localhost /]#  mkdir /wj        //创建目录
      [root@localhost /]#  chmod 777 /wj   //设置权限

3、修改配置文件“/etc/samba/smb.cnf”
      [root@localhost /]#  gedit /etc/samba/smb.conf
      # ----------------------- Standalone Server Options ------------------------
      # Scurity can be set to user, share(deprecated) or server(deprecated)
      # Backend to store user information in. New installations should 
      # use either tdbsam or ldapsam. smbpasswd is available for backwards 
      # compatibility. tdbsam requires no further configuration
      security = share           //这里默认是user,改为share,这样不用输入密码就可访问
      passdb backend = tdbsam

     [wj]                //创建共享目录配置
      comment=wj       //名字
      path=/wj         //路径
      read only=no    //是否只读,这里为no,这样用户就可以创建文件夹
      guest ok=yes    //是否允许guest用户登录
      browseable=yes //是否可以浏览目录


4、修改防火墙,打开tcp的端口137、138、139、445
      [root@localhost wj]#  gedit /etc/sysconfig/iptables
       -A INPUT -m state --state NEW -m tcp -p tcp --dport 137 -j ACCEPT
      -A INPUT -m state --state NEW -m tcp -p tcp --dport 138 -j ACCEPT
      -A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
      -A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT


       [root@localhost wj]#  service iptables restart
      iptables:将链设置为政策 ACCEPT:filter nat                [确定]
      iptables:清除防火墙规则:                                 [确定]
      iptables:正在卸载模块:                                   [确定]
      iptables:应用防火墙规则:                                 [确定]
      iptables:载入额外模块:nf_conntrack_ftp                   [确定]

5、启动smb服务
      [root@localhost wj]#  service smb start
      启动 SMB 服务:                                            [确定]

6、测试,在终端输入命令“testparm”,可以看到共享目录的信息
      [root@localhost wj]#  testparm
      Load smb config files from /etc/samba/smb.conf
      rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
      Processing section "[homes]"
      Processing section "[printers]"
      Processing section "[wj]"
      WARNING: The security=share option is deprecated
      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
      security = SHARE
      log file = /var/log/samba/log.%m
      max log size = 50
      idmap config * : backend = tdb
      cups options = raw

      [homes]
      comment = Home Directories
      read only = No
      browseable = No

      [printers]
      comment = All Printers
      path = /var/spool/samba
      printable = Yes
      print ok = Yes
      browseable = No

       [wj]
      comment = wj            //名字
      path = /wj              //路径
      read only = No         //是否只读
      guest ok = Yes         //是否允许guest访问


7、从windows测试,按下快捷键“window+r”,在弹出的窗口输入命令“smb:\\192.168.0.113”,可以看到本机的共享目录
      
      
相关文章
|
2天前
|
Linux 开发工具 C语言
Linux 安装 gcc 编译运行 C程序
Linux 安装 gcc 编译运行 C程序
20 0
|
2天前
|
Ubuntu Linux Python
Linux(15)Ubuntu安装ninja构建工具
Linux(15)Ubuntu安装ninja构建工具
13 0
|
1天前
|
监控 安全 Linux
Linux系统之安装ServerBee服务器监控工具
【4月更文挑战第22天】Linux系统之安装ServerBee服务器监控工具
35 2
|
1天前
|
存储 分布式计算 NoSQL
MongoDB的简介和安装(在服务器上)
MongoDB的简介和安装(在服务器上)
11 0
|
2天前
|
Linux 开发工具 Android开发
Docker系列(1)安装Linux系统编译Android源码
Docker系列(1)安装Linux系统编译Android源码
4 0
|
2天前
|
Ubuntu Linux 开发工具
WSL2(3)安装Linux headers完美解决方案
WSL2(3)安装Linux headers完美解决方案
3 0
|
2天前
|
Ubuntu Linux 数据安全/隐私保护
Linux(7)Ubuntu20.04 arm64安装Docker
Linux(7)Ubuntu20.04 arm64安装Docker
14 0
|
5天前
|
网络协议 安全 Linux
IDEA通过内网穿透实现固定公网地址远程SSH连接本地Linux服务器
IDEA通过内网穿透实现固定公网地址远程SSH连接本地Linux服务器
|
6月前
|
Java 关系型数据库 MySQL
【Linux环境配置】Linux系统安装jdk1.8操作步骤
【Linux环境配置】Linux系统安装jdk1.8操作步骤
240 0
|
存储 Linux 数据安全/隐私保护
linux系统安装步骤
linux系统安装步骤
251 0
linux系统安装步骤