A:设置 samba 需要帐号和密码才能访问:

B:人人都可以访问samba:

C:设置只有指定的人才可以改写的共享:

D:两个小技巧

A设置 samba 需要帐号和密码才能访问:

[root@yaho samba]# vi samba.conf

  1. 修改文件内参数:

    ------ Standalone Server Options --------

 security =user             #需要提供samba帐户和密码才能登录

===== Share Definitions ===========

;[homes]                                        # 注释掉连接时显示用户主目录信息

;       comment = Home Directories

;       browseable = no

;       writable = yes

;       valid users = %S

;       valid users = MYDOMAIN\%S

2.定位到文件末尾,修改[public]:

        [public]                       #共享名

        comment = Public Stuff         #共享说明

        path = /home/public            #共享目录路径

        public = no                    #是否允许guest账户访问

        writable = yes                 #是否可写        

        

B:人人都可以访问samba:

  1. 修改文件内参数:

    ------ Standalone Server Options --------

 security =share         #不需要提供samba帐户和密码就能登录

2.其他步骤和A相同

C:     [public]                       #共享名

        comment = Public Stuff         #共享说明

        path = /home/public            #共享目录路径

        public = no                    #是否允许guest账户访问

        writable = no                  #共享不可写

        write list= user1 user2        #但user1 和 user2可以进行写操作

D:登录smbclient //127.0.0.1/public 后

lcd 命令可以切换本地路径。

cld后,输入 put 或 get 命令后 按Tab 可以浏览本地文件。

示例:

[global]

        workgroup = workgroup

        server string = Samba Server Version %v

        security = user

        passdb backend = tdbsam

        load printers = yes

        cups options = raw

;[homes]

;        comment = Home Directories

;        browseable = no

;        writable = yes

[printers]

        comment = All Printers

        path = /var/spool/samba

        browseable = no

        guest ok = no

        writable = no

        printable = yes

[public]

        comment = Public Stuff

        path = /app

        public = no

        writable = yes