{"id":31,"date":"2010-04-06T21:46:01","date_gmt":"2010-04-07T00:46:01","guid":{"rendered":"http:\/\/localhost\/blog\/?p=31"},"modified":"2020-01-16T21:37:44","modified_gmt":"2020-01-17T00:37:44","slug":"configurando-o-samba-no-linux","status":"publish","type":"post","link":"https:\/\/www.l9web.com.br\/blog\/?p=31","title":{"rendered":"Configurando o Samba no Linux"},"content":{"rendered":"<p><strong>Configurando o Samba no Linux<\/strong><\/p>\n<p>O que \u00e9 o Samba?<\/p>\n<p>Samba \u00e9 um programa do linux que permite o compartilhamento com redes\u00a0<strong>MICROSOFT<\/strong>.<\/p>\n<p>Para a configura\u00e7\u00e3o do Samba no Linux \u00e9 necess\u00e1rio alterar um arquivo chamado \u201csmb.conf\u201d. Esse arquivo fica localizado na pasta \/etc\/samba. Vamos l\u00e1:<\/p>\n<p>1 \u2013 Abra o console e digite\u00a0<strong>sudo gedit \/etc\/samba\/smb.conf<\/strong><\/p>\n<p>2 \u2013 Abrir\u00e1 o editor de texto gedit e nele precisamos alterar algumas linhas de comando. Segue abaixo o arquivo alterado e comentado.<\/p>\n<ul>\n<li>\u201cusershare owner only = false\u201d Essa linha permite criar compartilhamentos sem ser root (n\u00e3o \u00e9 obrigat\u00f3rio nem recomendado)<\/li>\n<li>\u201cworkgroup = LUCASGROUP\u201d Essa linha especifica o grupo de trabalho<\/li>\n<li>\u201csecurity = share\u201d Essa linha por padr\u00e3o vem com \u201csecurity=user\u201d, colocando share siginifica que n\u00e3o precisa de autentica\u00e7\u00e3o de usu\u00e1rio<\/li>\n<\/ul>\n<p>A parte dos compartilhamentos \u00e9 a seguinte<\/p>\n<p>[PASTA_LUCAS] *Nome da pasta<br \/>\npath = \/media\/HD1000\/CLIPES *endere\u00e7o da pasta<br \/>\nbrowseable = yes *significa que ela \u00e9 naveg\u00e1vel, explor\u00e1vel<br \/>\nwritable = yes * significa que \u00e9 grav\u00e1vel<br \/>\nguest ok = yes * significa que usu\u00e1rios n\u00e3o registrados podem entrar na pasta<br \/>\ncreate mask = 777 * ao criar arquivos a m\u00e1scara deles ser\u00e1 777, ou seja leitura e escrita<br \/>\ndirectory mask = 777 * ao criar diret\u00f3rios a m\u00e1scara deles ser\u00e1 777, ou seja leitura e escrita<\/p>\n<p>[DADOS]<br \/>\npath = \/Dados<br \/>\nbrowseable = yes<br \/>\nwritable = yes<br \/>\nguest ok = yes<br \/>\ncreate mask = 777<br \/>\ndirectory mask = 777<\/p>\n<p>Abaixo o arquivo na \u00edntegra.<\/p>\n<p>\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/p>\n<p>#<br \/>\n# Sample configuration file for the Samba suite for Debian GNU\/Linux.<br \/>\n#<br \/>\n#<br \/>\n# This is the main Samba configuration file. You should read the<br \/>\n# smb.conf(5) manual page in order to understand the options listed<br \/>\n# here. Samba has a huge number of configurable options most of which<br \/>\n# are not shown in this example<br \/>\n#<br \/>\n# Some options that are often worth tuning have been included as<br \/>\n# commented-out examples in this file.<br \/>\n# \u2013 When such options are commented with \u201c;\u201d, the proposed setting<br \/>\n# differs from the default Samba behaviour<br \/>\n# \u2013 When commented with \u201c#\u201d, the proposed setting is the default<br \/>\n# behaviour of Samba but the option is considered important<br \/>\n# enough to be mentioned here<br \/>\n#<br \/>\n# NOTE: Whenever you modify this file you should run the command<br \/>\n# \u201ctestparm\u201d to check that you have not made any basic syntactic<br \/>\n# errors.<br \/>\n# A well-established practice is to name the original file<br \/>\n# \u201csmb.conf.master\u201d and create the \u201creal\u201d config file with<br \/>\n# testparm -s smb.conf.master &gt;smb.conf<br \/>\n# This minimizes the size of the really used smb.conf file<br \/>\n# which, according to the Samba Team, impacts performance<br \/>\n# However, use this with caution if your smb.conf file contains nested<br \/>\n# \u201cinclude\u201d statements. See Debian bug #483187 for a case<br \/>\n# where using a master file is not a good idea.<br \/>\n#<\/p>\n<p>#======================= Global Settings =======================<\/p>\n<p>[global]<br \/>\nusershare owner only = false<\/p>\n<p>## Browsing\/Identification ###<\/p>\n<p># Change this to the workgroup\/NT-domain name your Samba server will part of<br \/>\nworkgroup = LUCASGROUP<\/p>\n<p># server string is the equivalent of the NT Description field<br \/>\nserver string = %h server (Samba, Ubuntu)<\/p>\n<p># Windows Internet Name Serving Support Section:<br \/>\n# WINS Support \u2013 Tells the NMBD component of Samba to enable its WINS Server<br \/>\n# wins support = no<\/p>\n<p># WINS Server \u2013 Tells the NMBD components of Samba to be a WINS Client<br \/>\n# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both<br \/>\n; wins server = w.x.y.z<\/p>\n<p># This will prevent nmbd to search for NetBIOS names through DNS.<br \/>\ndns proxy = no<\/p>\n<p># What naming service and in what order should we use to resolve host names<br \/>\n# to IP addresses<br \/>\n; name resolve order = lmhosts host wins bcast<\/p>\n<p>#### Networking ####<\/p>\n<p># The specific set of interfaces \/ networks to bind to<br \/>\n# This can be either the interface name or an IP address\/netmask;<br \/>\n# interface names are normally preferred<br \/>\n; interfaces = 127.0.0.0\/8 eth0<\/p>\n<p># Only bind to the named interfaces and\/or networks; you must use the<br \/>\n# \u2018interfaces\u2019 option above to use this.<br \/>\n# It is recommended that you enable this feature if your Samba machine is<br \/>\n# not protected by a firewall or is a firewall itself. However, this<br \/>\n# option cannot handle dynamic or non-broadcast interfaces correctly.<br \/>\n; bind interfaces only = yes<\/p>\n<p>#### Debugging\/Accounting ####<\/p>\n<p># This tells Samba to use a separate log file for each machine<br \/>\n# that connects<br \/>\nlog file = \/var\/log\/samba\/log.%m<\/p>\n<p># Cap the size of the individual log files (in KiB).<br \/>\nmax log size = 1000<\/p>\n<p># If you want Samba to only log through syslog then set the following<br \/>\n# parameter to \u2018yes\u2019.<br \/>\n# syslog only = no<\/p>\n<p># We want Samba to log a minimum amount of information to syslog. Everything<br \/>\n# should go to \/var\/log\/samba\/log.{smbd,nmbd} instead. If you want to log<br \/>\n# through syslog you should set the following parameter to something higher.<br \/>\nsyslog = 0<\/p>\n<p># Do something sensible when Samba crashes: mail the admin a backtrace<br \/>\npanic action = \/usr\/share\/samba\/panic-action %d<\/p>\n<p>####### Authentication #######<\/p>\n<p># \u201csecurity = user\u201d is always a good idea. This will require a Unix account<br \/>\n# in this server for every user accessing the server. See<br \/>\n# \/usr\/share\/doc\/samba-doc\/htmldocs\/Samba3-HOWTO\/ServerType.html<br \/>\n# in the samba-doc package for details.<br \/>\nsecurity = share<\/p>\n<p># You may wish to use password encryption. See the section on<br \/>\n# \u2018encrypt passwords\u2019 in the smb.conf(5) manpage before enabling.<br \/>\nencrypt passwords = true<\/p>\n<p># If you are using encrypted passwords, Samba will need to know what<br \/>\n# password database type you are using.<br \/>\npassdb backend = tdbsam<\/p>\n<p>obey pam restrictions = yes<\/p>\n<p># This boolean parameter controls whether Samba attempts to sync the Unix<br \/>\n# password with the SMB password when the encrypted SMB password in the<br \/>\n# passdb is changed.<br \/>\nunix password sync = yes<\/p>\n<p># For Unix password sync to work on a Debian GNU\/Linux system, the following<br \/>\n# parameters must be set (thanks to Ian Kahan &lt;&lt;kahan@informatik.tu-muenchen.de&gt; for<br \/>\n# sending the correct chat script for the passwd program in Debian Sarge).<br \/>\npasswd program = \/usr\/bin\/passwd %u<br \/>\npasswd chat = *Enter\\snew\\s*\\spassword:* %n\\n *Retype\\snew\\s*\\spassword:* %n\\n *password\\supdated\\ssuccessfully* .<\/p>\n<p># This boolean controls whether PAM will be used for password changes<br \/>\n# when requested by an SMB client instead of the program listed in<br \/>\n# \u2018passwd program\u2019. The default is \u2018no\u2019.<br \/>\npam password change = yes<\/p>\n<p># This option controls how unsuccessful authentication attempts are mapped<br \/>\n# to anonymous connections<br \/>\nmap to guest = bad user<\/p>\n<p>########## Domains ###########<\/p>\n<p># Is this machine able to authenticate users. Both PDC and BDC<br \/>\n# must have this setting enabled. If you are the BDC you must<br \/>\n# change the \u2018domain master\u2019 setting to no<br \/>\n#<br \/>\n; domain logons = yes<br \/>\n#<br \/>\n# The following setting only takes effect if \u2018domain logons\u2019 is set<br \/>\n# It specifies the location of the user\u2019s profile directory<br \/>\n# from the client point of view)<br \/>\n# The following required a [profiles] share to be setup on the<br \/>\n# samba server (see below)<br \/>\n; logon path = \\\\%N\\profiles\\%U<br \/>\n# Another common choice is storing the profile in the user\u2019s home directory<br \/>\n# (this is Samba\u2019s default)<br \/>\n# logon path = \\\\%N\\%U\\profile<\/p>\n<p># The following setting only takes effect if \u2018domain logons\u2019 is set<br \/>\n# It specifies the location of a user\u2019s home directory (from the client<br \/>\n# point of view)<br \/>\n; logon drive = H:<br \/>\n# logon home = \\\\%N\\%U<\/p>\n<p># The following setting only takes effect if \u2018domain logons\u2019 is set<br \/>\n# It specifies the script to run during logon. The script must be stored<br \/>\n# in the [netlogon] share<br \/>\n# NOTE: Must be store in \u2018DOS\u2019 file format convention<br \/>\n; logon script = logon.cmd<\/p>\n<p># This allows Unix users to be created on the domain controller via the SAMR<br \/>\n# RPC pipe. The example command creates a user account with a disabled Unix<br \/>\n# password; please adapt to your needs<br \/>\n; add user script = \/usr\/sbin\/adduser \u2013quiet \u2013disabled-password \u2013gecos \u201c\u201d %u<\/p>\n<p># This allows machine accounts to be created on the domain controller via the<br \/>\n# SAMR RPC pipe.<br \/>\n# The following assumes a \u201cmachines\u201d group exists on the system<br \/>\n; add machine script = \/usr\/sbin\/useradd -g machines -c \u201c%u machine account\u201d -d \/var\/lib\/samba -s \/bin\/false %u<\/p>\n<p># This allows Unix groups to be created on the domain controller via the SAMR<br \/>\n# RPC pipe.<br \/>\n; add group script = \/usr\/sbin\/addgroup \u2013force-badname %g<\/p>\n<p>########## Printing ##########<\/p>\n<p># If you want to automatically load your printer list rather<br \/>\n# than setting them up individually then you\u2019ll need this<br \/>\n# load printers = yes<\/p>\n<p># lpr(ng) printing. You may wish to override the location of the<br \/>\n# printcap file<br \/>\n; printing = bsd<br \/>\n; printcap name = \/etc\/printcap<\/p>\n<p># CUPS printing. See also the cupsaddsmb(8) manpage in the<br \/>\n# cupsys-client package.<br \/>\n; printing = cups<br \/>\n; printcap name = cups<\/p>\n<p>############ Misc ############<\/p>\n<p># Using the following line enables you to customise your configuration<br \/>\n# on a per machine basis. The %m gets replaced with the netbios name<br \/>\n# of the machine that is connecting<br \/>\n; include = \/home\/samba\/etc\/smb.conf.%m<\/p>\n<p># Most people will find that this option gives better performance.<br \/>\n# See smb.conf(5) and \/usr\/share\/doc\/samba-doc\/htmldocs\/Samba3-HOWTO\/speed.html<br \/>\n# for details<br \/>\n# You may want to add the following on a Linux system:<br \/>\n# SO_RCVBUF=8192 SO_SNDBUF=8192<br \/>\n# socket options = TCP_NODELAY<\/p>\n<p># The following parameter is useful only if you have the linpopup package<br \/>\n# installed. The samba maintainer and the linpopup maintainer are<br \/>\n# working to ease installation and configuration of linpopup and samba.<br \/>\n; message command = \/bin\/sh -c \u2018\/usr\/bin\/linpopup \u201c%f\u201d \u201c%m\u201d %s; rm %s\u2019 &amp;<\/p>\n<p># Domain Master specifies Samba to be the Domain Master Browser. If this<br \/>\n# machine will be configured as a BDC (a secondary logon server), you<br \/>\n# must set this to \u2018no\u2019; otherwise, the default behavior is recommended.<br \/>\n# domain master = auto<\/p>\n<p># Some defaults for winbind (make sure you\u2019re not using the ranges<br \/>\n# for something else.)<br \/>\n; idmap uid = 10000-20000<br \/>\n; idmap gid = 10000-20000<br \/>\n; template shell = \/bin\/bash<\/p>\n<p># The following was the default behaviour in sarge,<br \/>\n# but samba upstream reverted the default because it might induce<br \/>\n# performance issues in large organizations.<br \/>\n# See Debian bug #368251 for some of the consequences of *not*<br \/>\n# having this setting and smb.conf(5) for details.<br \/>\n; winbind enum groups = yes<br \/>\n; winbind enum users = yes<\/p>\n<p># Setup usershare options to enable non-root users to share folders<br \/>\n# with the net usershare command.<\/p>\n<p># Maximum number of usershare. 0 (default) means that usershare is disabled.<br \/>\n; usershare max shares = 100<\/p>\n<p># Allow users who\u2019ve been granted usershare privileges to create<br \/>\n# public shares, not just authenticated ones<br \/>\nusershare allow guests = yes<\/p>\n<p>#======================= Share Definitions =======================<\/p>\n<p># Un-comment the following (and tweak the other settings below to suit)<br \/>\n# to enable the default home directory shares. This will share each<br \/>\n# user\u2019s home directory as \\\\server\\username<br \/>\n;[homes]<br \/>\n; comment = Home Directories<br \/>\n; browseable = no<\/p>\n<p># By default, the home directories are exported read-only. Change the<br \/>\n# next parameter to \u2018no\u2019 if you want to be able to write to them.<br \/>\n; read only = yes<\/p>\n<p># File creation mask is set to 0700 for security reasons. If you want to<br \/>\n# create files with group=rw permissions, set next parameter to 0775.<br \/>\n; create mask = 0700<\/p>\n<p># Directory creation mask is set to 0700 for security reasons. If you want to<br \/>\n# create dirs. with group=rw permissions, set next parameter to 0775.<br \/>\n; directory mask = 0700<\/p>\n<p># By default, \\\\server\\username shares can be connected to by anyone<br \/>\n# with access to the samba server. Un-comment the following parameter<br \/>\n# to make sure that only \u201cusername\u201d can connect to \\\\server\\username<br \/>\n# This might need tweaking when using external authentication schemes<br \/>\n; valid users = %S<\/p>\n<p># Un-comment the following and create the netlogon directory for Domain Logons<br \/>\n# (you need to configure Samba to act as a domain controller too.)<br \/>\n;[netlogon]<br \/>\n; comment = Network Logon Service<br \/>\n; path = \/home\/samba\/netlogon<br \/>\n; guest ok = yes<br \/>\n; read only = yes<br \/>\n; share modes = no<\/p>\n<p># Un-comment the following and create the profiles directory to store<br \/>\n# users profiles (see the \u201clogon path\u201d option above)<br \/>\n# (you need to configure Samba to act as a domain controller too.)<br \/>\n# The path below should be writable by all users so that their<br \/>\n# profile directory may be created the first time they log on<br \/>\n;[profiles]<br \/>\n; comment = Users profiles<br \/>\n; path = \/home\/samba\/profiles<br \/>\n; guest ok = no<br \/>\n; browseable = no<br \/>\n; create mask = 0600<br \/>\n; directory mask = 0700<\/p>\n<p>[printers]<br \/>\ncomment = All Printers<br \/>\nbrowseable = no<br \/>\npath = \/var\/spool\/samba<br \/>\nprintable = yes<br \/>\nguest ok = no<br \/>\nread only = yes<br \/>\ncreate mask = 0700<\/p>\n<p>[public]<br \/>\npath = \/media\/HD1000\/Teste<br \/>\nbrowseable = yes<br \/>\nwritable = yes<br \/>\nguest ok = yes<br \/>\ncreate mask = 777<br \/>\ndirectory mask = 777<\/p>\n<p>[PASTA_LUCAS]<br \/>\npath = \/media\/HD1000\/CLIPES<br \/>\nbrowseable = yes<br \/>\nwritable = yes<br \/>\nguest ok = yes<br \/>\ncreate mask = 777<br \/>\ndirectory mask = 777<\/p>\n<p>[DADOS]<br \/>\npath = \/Dados<br \/>\nbrowseable = yes<br \/>\nwritable = yes<br \/>\nguest ok = yes<br \/>\ncreate mask = 777<br \/>\ndirectory mask = 777<\/p>\n<p># Windows clients look for this share name as a source of downloadable<br \/>\n# printer drivers<br \/>\n[print$]<br \/>\ncomment = Printer Drivers<br \/>\npath = \/var\/lib\/samba\/printers<br \/>\nbrowseable = yes<br \/>\nread only = yes<br \/>\nguest ok = no<br \/>\n# Uncomment to allow remote administration of Windows print drivers.<br \/>\n# You may need to replace \u2018lpadmin\u2019 with the name of the group your<br \/>\n# admin users are members of.<br \/>\n# Please note that you also need to set appropriate Unix permissions<br \/>\n# to the drivers directory for these users to have write rights in it<br \/>\n; write list = root, @lpadmin<\/p>\n<p># A sample share for sharing your CD-ROM with others.<br \/>\n;[cdrom]<br \/>\n; comment = Samba server\u2019s CD-ROM<br \/>\n; read only = yes<br \/>\n; locking = no<br \/>\n; path = \/cdrom<br \/>\n; guest ok = yes<\/p>\n<p># The next two parameters show how to auto-mount a CD-ROM when the<br \/>\n# cdrom share is accesed. For this to work \/etc\/fstab must contain<br \/>\n# an entry like this:<br \/>\n#<br \/>\n# \/dev\/scd0 \/cdrom iso9660 defaults,noauto,ro,user 0 0<br \/>\n#<br \/>\n# The CD-ROM gets unmounted automatically after the connection to the<br \/>\n#<br \/>\n# If you don\u2019t want to use auto-mounting\/unmounting make sure the CD<br \/>\n# is mounted on \/cdrom<br \/>\n#<br \/>\n; preexec = \/bin\/mount \/cdrom<br \/>\n; postexec = \/bin\/umount \/cdrom<\/p>\n<p>\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014-<\/p>\n<p>Ap\u00f3s salvar o arquivo de configura\u00e7\u00e3o voc\u00ea precisa reiniciar o servi\u00e7o do samba, abra o console e digite:\u00a0<strong>sudo service samba restart<\/strong><\/p>\n<p>Est\u00e1 pronto! Espero que ajude algu\u00e9m, qualquer d\u00favida, corre\u00e7\u00e3o ou sugest\u00e3o ser\u00e3o bem-vindas!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Configurando o Samba no Linux O que \u00e9 o Samba? Samba \u00e9 um programa do linux que permite o compartilhamento com redes\u00a0MICROSOFT. Para a configura\u00e7\u00e3o do Samba no Linux \u00e9 necess\u00e1rio alterar um arquivo chamado \u201csmb.conf\u201d. Esse arquivo fica localizado&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[8,54,101,113,121,176],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-linux","tag-etcsambasmb-conf","tag-configurar-samba","tag-instalar-samba","tag-l9web-lucascatani","tag-linux-samba","tag-smb-conf"],"_links":{"self":[{"href":"https:\/\/www.l9web.com.br\/blog\/index.php?rest_route=\/wp\/v2\/posts\/31"}],"collection":[{"href":"https:\/\/www.l9web.com.br\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.l9web.com.br\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.l9web.com.br\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.l9web.com.br\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=31"}],"version-history":[{"count":1,"href":"https:\/\/www.l9web.com.br\/blog\/index.php?rest_route=\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":339,"href":"https:\/\/www.l9web.com.br\/blog\/index.php?rest_route=\/wp\/v2\/posts\/31\/revisions\/339"}],"wp:attachment":[{"href":"https:\/\/www.l9web.com.br\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.l9web.com.br\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.l9web.com.br\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}