当前位置:   article > 正文

samba用户权限配置_samba你需要权限来执行此操作

samba你需要权限来执行此操作

   开始前先上主要配图

    这个图片主要说明了各个配置的用途.

    

    安装samba的方法网上有很多,这里不说了。

    安装完毕后先在linux下创建用户(注意用户的格式,好像是要小写开头)

 

 sudo adduser XXX

    通过以下命令将用户XXX添加到组YYY里面

sudo usermod -g YYY XXX

 

   那如何添加组呢?

 

sudo groupadd  YYY

 

    

   接下来就配置samba的smb.conf文件。如无意外,通过如下命令可以打开编辑smb.conf配置文件

 

sudo pico /etc/samba/smb.conf


    好了接下来就把主要的配置文件配置好

 

 

  1. [AA]
  2. comment = AA
  3. path = /samba/A
  4. public = no
  5. valid users = b02,b01,c01,a01,@A
  6. write list = @A
  7. printable = no
  8. [BB]
  9. comment = BB
  10. path = /samba/B
  11. public = no
  12. valid users = a01,c01,b01,@B
  13. printable = no
  14. write list = @B
  15. [CC]
  16. comment = CC
  17. path = /samba/C
  18. public = no
  19. valid users = a01,b01,c01,@C
  20. printable = no
  21. write list = @C
  22. [public-readonly]
  23. comment = public-readonly
  24. path = /samba/public-readonly
  25. public = yes
  26. read only = yes
  27. [share-rw]
  28. comment = share-rw
  29. path = /samba/share-rw
  30. public = yes
  31. writable = yes
  32. #sudo chmod 1777 /samba/share-rw


     配置好了之后,建立知道的文件夹,然后开放文件夹权限。类似

 

 

  1. sudo mkdir kkkk
  2. sudo chmod 777 kkkk


    最后就得重新重启samba啦

 

 

sudo /etc/init.d/samba restart

 

 

 贴上我自己的smb.conf配置文件内容

 

  1. #
  2. # Sample configuration file for the Samba suite for Debian GNU/Linux.
  3. #
  4. #
  5. # This is the main Samba configuration file. You should read the
  6. # smb.conf(5) manual page in order to understand the options listed
  7. # here. Samba has a huge number of configurable options most of which
  8. # are not shown in this example
  9. #
  10. # Some options that are often worth tuning have been included as
  11. # commented-out examples in this file.
  12. # - When such options are commented with ";", the proposed setting
  13. # differs from the default Samba behaviour
  14. # - When commented with "#", the proposed setting is the default
  15. # behaviour of Samba but the option is considered important
  16. # enough to be mentioned here
  17. #
  18. # NOTE: Whenever you modify this file you should run the command
  19. # "testparm" to check that you have not made any basic syntactic
  20. # errors.
  21. #======================= Global Settings =======================
  22. [global]
  23. ## Browsing/Identification ###
  24. # Change this to the workgroup/NT-domain name your Samba server will part of
  25. #jack modify
  26. workgroup = JACK
  27. server string = jack Test File Server
  28. security = user
  29. encrypt passwords = yes
  30. smb passwd file = /etc/passwd
  31. # Windows Internet Name Serving Support Section:
  32. # WINS Support - Tells the NMBD component of Samba to enable its WINS Server
  33. # wins support = no
  34. # WINS Server - Tells the NMBD components of Samba to be a WINS Client
  35. # Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
  36. ; wins server = w.x.y.z
  37. # This will prevent nmbd to search for NetBIOS names through DNS.
  38. dns proxy = no
  39. #### Networking ####
  40. # The specific set of interfaces / networks to bind to
  41. # This can be either the interface name or an IP address/netmask;
  42. # interface names are normally preferred
  43. ; interfaces = 127.0.0.0/8 eth0
  44. # Only bind to the named interfaces and/or networks; you must use the
  45. # 'interfaces' option above to use this.
  46. # It is recommended that you enable this feature if your Samba machine is
  47. # not protected by a firewall or is a firewall itself. However, this
  48. # option cannot handle dynamic or non-broadcast interfaces correctly.
  49. ; bind interfaces only = yes
  50. #### Debugging/Accounting ####
  51. # This tells Samba to use a separate log file for each machine
  52. # that connects
  53. log file = /var/log/samba/log.%m
  54. # Cap the size of the individual log files (in KiB).
  55. max log size = 1000
  56. # If you want Samba to only log through syslog then set the following
  57. # parameter to 'yes'.
  58. # syslog only = no
  59. # We want Samba to log a minimum amount of information to syslog. Everything
  60. # should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
  61. # through syslog you should set the following parameter to something higher.
  62. syslog = 0
  63. # Do something sensible when Samba crashes: mail the admin a backtrace
  64. panic action = /usr/share/samba/panic-action %d
  65. ####### Authentication #######
  66. # Server role. Defines in which mode Samba will operate. Possible
  67. # values are "standalone server", "member server", "classic primary
  68. # domain controller", "classic backup domain controller", "active
  69. # directory domain controller".
  70. #
  71. # Most people will want "standalone sever" or "member server".
  72. # Running as "active directory domain controller" will require first
  73. # running "samba-tool domain provision" to wipe databases and create a
  74. # new domain.
  75. server role = standalone server
  76. # If you are using encrypted passwords, Samba will need to know what
  77. # password database type you are using.
  78. passdb backend = tdbsam
  79. obey pam restrictions = yes
  80. # This boolean parameter controls whether Samba attempts to sync the Unix
  81. # password with the SMB password when the encrypted SMB password in the
  82. # passdb is changed.
  83. unix password sync = yes
  84. # For Unix password sync to work on a Debian GNU/Linux system, the following
  85. # parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
  86. # sending the correct chat script for the passwd program in Debian Sarge).
  87. passwd program = /usr/bin/passwd %u
  88. passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
  89. # This boolean controls whether PAM will be used for password changes
  90. # when requested by an SMB client instead of the program listed in
  91. # 'passwd program'. The default is 'no'.
  92. pam password change = yes
  93. # This option controls how unsuccessful authentication attempts are mapped
  94. # to anonymous connections
  95. map to guest = bad user
  96. ########## Domains ###########
  97. #
  98. # The following settings only takes effect if 'server role = primary
  99. # classic domain controller', 'server role = backup domain controller'
  100. # or 'domain logons' is set
  101. #
  102. # It specifies the location of the user's
  103. # profile directory from the client point of view) The following
  104. # required a [profiles] share to be setup on the samba server (see
  105. # below)
  106. ; logon path = \\%N\profiles\%U
  107. # Another common choice is storing the profile in the user's home directory
  108. # (this is Samba's default)
  109. # logon path = \\%N\%U\profile
  110. # The following setting only takes effect if 'domain logons' is set
  111. # It specifies the location of a user's home directory (from the client
  112. # point of view)
  113. ; logon drive = H:
  114. # logon home = \\%N\%U
  115. # The following setting only takes effect if 'domain logons' is set
  116. # It specifies the script to run during logon. The script must be stored
  117. # in the [netlogon] share
  118. # NOTE: Must be store in 'DOS' file format convention
  119. ; logon script = logon.cmd
  120. # This allows Unix users to be created on the domain controller via the SAMR
  121. # RPC pipe. The example command creates a user account with a disabled Unix
  122. # password; please adapt to your needs
  123. ; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u
  124. # This allows machine accounts to be created on the domain controller via the
  125. # SAMR RPC pipe.
  126. # The following assumes a "machines" group exists on the system
  127. ; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
  128. # This allows Unix groups to be created on the domain controller via the SAMR
  129. # RPC pipe.
  130. ; add group script = /usr/sbin/addgroup --force-badname %g
  131. ############ Misc ############
  132. # Using the following line enables you to customise your configuration
  133. # on a per machine basis. The %m gets replaced with the netbios name
  134. # of the machine that is connecting
  135. ; include = /home/samba/etc/smb.conf.%m
  136. # Some defaults for winbind (make sure you're not using the ranges
  137. # for something else.)
  138. ; idmap uid = 10000-20000
  139. ; idmap gid = 10000-20000
  140. ; template shell = /bin/bash
  141. # Setup usershare options to enable non-root users to share folders
  142. # with the net usershare command.
  143. # Maximum number of usershare. 0 (default) means that usershare is disabled.
  144. ; usershare max shares = 100
  145. # Allow users who've been granted usershare privileges to create
  146. # public shares, not just authenticated ones
  147. usershare allow guests = yes
  148. #======================= Share Definitions =======================
  149. [homes]
  150. comment = Home Directories
  151. browseable = yes
  152. # By default, the home directories are exported read-only. Change the
  153. # next parameter to 'no' if you want to be able to write to them.
  154. read only = no
  155. # File creation mask is set to 0700 for security reasons. If you want to
  156. # create files with group=rw permissions, set next parameter to 0775.
  157. create mask = 0700
  158. # Directory creation mask is set to 0700 for security reasons. If you want to
  159. # create dirs. with group=rw permissions, set next parameter to 0775.
  160. directory mask = 0700
  161. # By default, \\server\username shares can be connected to by anyone
  162. # with access to the samba server.
  163. # The following parameter makes sure that only "username" can connect
  164. # to \\server\username
  165. # This might need tweaking when using external authentication schemes
  166. valid users = %S
  167. # Un-comment the following and create the netlogon directory for Domain Logons
  168. # (you need to configure Samba to act as a domain controller too.)
  169. ;[netlogon]
  170. ; comment = Network Logon Service
  171. ; path = /home/samba/netlogon
  172. ; guest ok = yes
  173. ; read only = yes
  174. # Un-comment the following and create the profiles directory to store
  175. # users profiles (see the "logon path" option above)
  176. # (you need to configure Samba to act as a domain controller too.)
  177. # The path below should be writable by all users so that their
  178. # profile directory may be created the first time they log on
  179. ;[profiles]
  180. ; comment = Users profiles
  181. ; path = /home/samba/profiles
  182. ; guest ok = no
  183. ; browseable = no
  184. ; create mask = 0600
  185. ; directory mask = 0700
  186. #
  187. # Sample configuration file for the Samba suite for Debian GNU/Linux.
  188. #
  189. #
  190. # This is the main Samba configuration file. You should read the
  191. # smb.conf(5) manual page in order to understand the options listed
  192. # here. Samba has a huge number of configurable options most of which
  193. # are not shown in this example
  194. #
  195. # Some options that are often worth tuning have been included as
  196. # commented-out examples in this file.
  197. # - When such options are commented with ";", the proposed setting
  198. # differs from the default Samba behaviour
  199. # - When commented with "#", the proposed setting is the default
  200. # behaviour of Samba but the option is considered important
  201. # enough to be mentioned here
  202. #
  203. # NOTE: Whenever you modify this file you should run the command
  204. # "testparm" to check that you have not made any basic syntactic
  205. # errors.
  206. #======================= Global Settings =======================
  207. [global]
  208. ## Browsing/Identification ###
  209. # Change this to the workgroup/NT-domain name your Samba server will part of
  210. workgroup = JACK
  211. server string = JACK File Server
  212. # Windows Internet Name Serving Support Section:
  213. # WINS Support - Tells the NMBD component of Samba to enable its WINS Server
  214. # wins support = no
  215. # WINS Server - Tells the NMBD components of Samba to be a WINS Client
  216. # Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
  217. ; wins server = w.x.y.z
  218. # This will prevent nmbd to search for NetBIOS names through DNS.
  219. dns proxy = no
  220. #### Networking ####
  221. # The specific set of interfaces / networks to bind to
  222. # This can be either the interface name or an IP address/netmask;
  223. # interface names are normally preferred
  224. ; interfaces = 127.0.0.0/8 eth0
  225. # Only bind to the named interfaces and/or networks; you must use the
  226. # 'interfaces' option above to use this.
  227. # It is recommended that you enable this feature if your Samba machine is
  228. # not protected by a firewall or is a firewall itself. However, this
  229. # option cannot handle dynamic or non-broadcast interfaces correctly.
  230. ; bind interfaces only = yes
  231. #### Debugging/Accounting ####
  232. # This tells Samba to use a separate log file for each machine
  233. # that connects
  234. log file = /var/log/samba/log.%m
  235. # Cap the size of the individual log files (in KiB).
  236. max log size = 1000
  237. # If you want Samba to only log through syslog then set the following
  238. # parameter to 'yes'.
  239. # syslog only = no
  240. # We want Samba to log a minimum amount of information to syslog. Everything
  241. # should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
  242. # through syslog you should set the following parameter to something higher.
  243. syslog = 0
  244. # Do something sensible when Samba crashes: mail the admin a backtrace
  245. panic action = /usr/share/samba/panic-action %d
  246. ####### Authentication ####
  247. # Server role. Defines in which mode Samba will operate. Possible
  248. # values are "standalone server", "member server", "classic primary
  249. # domain controller", "classic backup domain controller", "active
  250. # directory domain controller".
  251. #
  252. # Most people will want "standalone sever" or "member server".
  253. # Running as "active directory domain controller" will require first
  254. # running "samba-tool domain provision" to wipe databases and create a
  255. # new domain.
  256. server role = standalone server
  257. # If you are using encrypted passwords, Samba will need to know what
  258. # password database type you are using.
  259. passdb backend = tdbsam
  260. obey pam restrictions = yes
  261. # This boolean parameter controls whether Samba attempts to sync the Unix
  262. # password with the SMB password when the encrypted SMB password in the
  263. # passdb is changed.
  264. unix password sync = yes
  265. # For Unix password sync to work on a Debian GNU/Linux system, the following
  266. # parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
  267. # sending the correct chat script for the passwd program in Debian Sarge).
  268. passwd program = /usr/bin/passwd %u
  269. passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
  270. # This boolean controls whether PAM will be used for password changes
  271. # when requested by an SMB client instead of the program listed in
  272. # 'passwd program'. The default is 'no'.
  273. pam password change = yes
  274. # This option controls how unsuccessful authentication attempts are mapped
  275. # to anonymous connections
  276. map to guest = bad user
  277. ########## Domains ###########
  278. #
  279. # The following settings only takes effect if 'server role = primary
  280. # classic domain controller', 'server role = backup domain controller'
  281. # or 'domain logons' is set
  282. #
  283. # It specifies the location of the user's
  284. # profile directory from the client point of view) The following
  285. # required a [profiles] share to be setup on the samba server (see
  286. # below)
  287. ; logon path = \\%N\profiles\%U
  288. # Another common choice is storing the profile in the user's home directory
  289. # (this is Samba's default)
  290. # logon path = \\%N\%U\profile
  291. # The following setting only takes effect if 'domain logons' is set
  292. # It specifies the location of a user's home directory (from the client
  293. # point of view)
  294. ; logon drive = H:
  295. # logon home = \\%N\%U
  296. # The following setting only takes effect if 'domain logons' is set
  297. # It specifies the script to run during logon. The script must be stored
  298. # in the [netlogon] share
  299. # NOTE: Must be store in 'DOS' file format convention
  300. ; logon script = logon.cmd
  301. # This allows Unix users to be created on the domain controller via the SAMR
  302. # RPC pipe. The example command creates a user account with a disabled Unix
  303. # password; please adapt to your needs
  304. ; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u
  305. # This allows machine accounts to be created on the domain controller via the
  306. # SAMR RPC pipe.
  307. # The following assumes a "machines" group exists on the system
  308. ; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
  309. # This allows Unix groups to be created on the domain controller via the SAMR
  310. # RPC pipe.
  311. ; add group script = /usr/sbin/addgroup --force-badname %g
  312. ############ Misc ############
  313. # Using the following line enables you to customise your configuration
  314. # on a per machine basis. The %m gets replaced with the netbios name
  315. # of the machine that is connecting
  316. ; include = /home/samba/etc/smb.conf.%m
  317. # Some defaults for winbind (make sure you're not using the ranges
  318. # for something else.)
  319. ; idmap uid = 10000-20000
  320. ; idmap gid = 10000-20000
  321. ; template shell = /bin/bash
  322. # Setup usershare options to enable non-root users to share folders
  323. # with the net usershare command.
  324. # Maximum number of usershare. 0 (default) means that usershare is disabled.
  325. ; usershare max shares = 100
  326. # Allow users who've been granted usershare privileges to create
  327. # public shares, not just authenticated ones
  328. usershare allow guests = yes
  329. #======================= Share Definitions =======================
  330. [homes]
  331. comment = Home Directories
  332. browseable = no
  333. # By default, the home directories are exported read-only. Change the
  334. # next parameter to 'no' if you want to be able to write to them.
  335. # read only = yes
  336. # File creation mask is set to 0700 for security reasons. If you want to
  337. # create files with group=rw permissions, set next parameter to 0775.
  338. create mask = 0700
  339. # Directory creation mask is set to 0700 for security reasons. If you want to
  340. # create dirs. with group=rw permissions, set next parameter to 0775.
  341. directory mask = 0700
  342. # By default, \\server\username shares can be connected to by anyone
  343. # with access to the samba server.
  344. # The following parameter makes sure that only "username" can connect
  345. # to \\server\username
  346. # This might need tweaking when using external authentication schemes
  347. valid users = %S
  348. #jack modify
  349. writable = yes
  350. # Un-comment the following and create the netlogon directory for Domain Logons
  351. # (you need to configure Samba to act as a domain controller too.)
  352. ;[netlogon]
  353. ; comment = Network Logon Service
  354. ; path = /home/samba/netlogon
  355. ; guest ok = yes
  356. ; read only = yes
  357. # Un-comment the following and create the profiles directory to store
  358. # users profiles (see the "logon path" option above)
  359. # (you need to configure Samba to act as a domain controller too.)
  360. # The path below should be writable by all users so that their
  361. # profile directory may be created the first time they log on
  362. ;[profiles]
  363. ; comment = Users profiles
  364. ; path = /home/samba/profiles
  365. ; guest ok = no
  366. ; browseable = no
  367. ; create mask = 0600
  368. ; directory mask = 0700
  369. [printers]
  370. comment = All Printers
  371. browseable = no
  372. path = /var/spool/samba
  373. printable = yes
  374. guest ok = no
  375. read only = yes
  376. create mask = 0700
  377. # Windows clients look for this share name as a source of downloadable
  378. # printer drivers
  379. [print$]
  380. comment = Printer Drivers
  381. path = /var/lib/samba/printers
  382. browseable = yes
  383. read only = yes
  384. guest ok = no
  385. # Uncomment to allow remote administration of Windows print drivers.
  386. # You may need to replace 'lpadmin' with the name of the group your
  387. # admin users are members of.
  388. # Please note that you also need to set appropriate Unix permissions
  389. # to the drivers directory for these users to have write rights in it
  390. ; write list = root, @lpadmin
  391. [printers]
  392. comment = All Printers
  393. browseable = no
  394. path = /var/spool/samba
  395. printable = yes
  396. guest ok = no
  397. read only = yes
  398. create mask = 0700
  399. # Windows clients look for this share name as a source of downloadable
  400. # printer drivers
  401. [print$]
  402. comment = Printer Drivers
  403. path = /var/lib/samba/printers
  404. browseable = yes
  405. read only = yes
  406. guest ok = no
  407. # Uncomment to allow remote administration of Windows print drivers.
  408. # You may need to replace 'lpadmin' with the name of the group your
  409. # admin users are members of.
  410. # Please note that you also need to set appropriate Unix permissions
  411. # to the drivers directory for these users to have write rights in it
  412. ; write list = root, @lpadmin
  413. [AA]
  414. comment = AA
  415. path = /samba/A
  416. public = no
  417. valid users = b02,b01,c01,a01,@A
  418. write list = @A
  419. printable = no
  420. [BB]
  421. comment = BB
  422. path = /samba/B
  423. public = no
  424. valid users = a01,c01,b01,@B
  425. printable = no
  426. write list = @B
  427. [CC]
  428. comment = CC
  429. path = /samba/C
  430. public = no
  431. valid users = a01,b01,c01,@C
  432. printable = no
  433. write list = @C
  434. [public-readonly]
  435. comment = public-readonly
  436. path = /samba/public-readonly
  437. public = yes
  438. read only = yes
  439. [share-rw]
  440. comment = share-rw
  441. path = /samba/share-rw
  442. public = yes
  443. writable = yes
  444. #sudo chmod 1777 /samba/share-rw

 

 

 

 

 

修改文件夹属性的时候,可以使用以下命令修改子文件夹属性

 

 sudo chmod -R 777 ./share

 

 

 

 

 

 

 

 

 linux方面的工作完成,接下来就去windows下面工作来

     按下 窗口键 + R 打开 "运行" 输入你的linux ip地址格式如 "\\xxx.xxx.xxx.xx"

     接着你可以通过你配置好的用户登陆你分配的文件夹了。

 

 

 

 

来自:http://blog.csdn.net/lan120576664

 

 

å¨è¿éæå¥å¾çæè¿°

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/182466
推荐阅读
相关标签
  

闽ICP备14008679号