1、嵌入式开发之centos6.6配置samba服务器

        嵌入式Linux开发的时候时常需用到samba服务来在linux和windows之间传送文件,所以需要在linux开发机上配置samba服务器,由于记性不太好,且开发过程中也不会经常去配置,因而每次换开发机或者重装都需要在网上找配置方法,这次同样又找了一次,在此记录备忘,谢谢网络上各位大神的无私奉献。

        由于只是开发,因此只需要最简单的配置就可以满足。


1、安装

yum installsamba samba-client samba-swat


2、修改配置文件:Samba的主配置文件为/etc/samba/smb.conf

由于只是简单的配置,只需要将用户的home目录共享出来就可以了,那么做如下修改,找到Share Definitions,把browseable = no改为browseable = yes即可

#============================ Share Definitions ==============================

[homes]
    comment = Home Directories
    browseable = yes
    writable = yes
;   valid users = %S
;   valid users = MYDOMAIN\%S


3、通过下面两条命令创建系统用户和samba用户,这两条命令都需要设置密码,可以不一样,第一条是登录密码,第二条是samba密码

扫描二维码关注公众号,回复: 3552229 查看本文章

useradd linux   //创建系统用户,用户名为linux
smbpasswd -a linux    //为linux创建samba权限<span style="color:#333333;">,必须是已有的系统用户才可以</span>

4永久关闭防火墙

chkconfig --level 35 iptables off

5 、关闭 selinux :编辑 /etc/selinux/config ,找到 SELINUX 行修改成为: SELINUX=disabled:

# This file controls the state of SELinux on the system. 
# SELINUX= can take one of these three values: 
# enforcing - SELinux security policy is enforced. 
# permissive - SELinux prints warnings instead of enforcing. 
# disabled - No SELinux policy is loaded. 
SELINUX=disabled
# SELINUXTYPE= can take one of these two values: 
# targeted - Only targeted network daemons are protected. 
# strict - Full SELinux protection. 
SELINUXTYPE=targeted 

6、重启系统。


7、重启samba

service smb restart
service nmb restart


8、通过windows测试:

在我的电脑通过映射网盘的方式可以测试:

如我的linux开发机是192.168.1.1则在文件夹栏输入下列命令,通过刚才设置的samba用户名和samba密码登录

\\192.168.1.1\linux









猜你喜欢

转载自blog.csdn.net/u013451404/article/details/47381807