Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
--Tutorial - Instalando e Configurando o Samba 4 no CentOS 7. Este tutorial é baseado em vários outros tutoriais na internet. E desde já fico muito grato aqueles que possam corrigir ou adicionar mais informações para melhoria do mesmo. ------------------------------------------------------------------------------------------------------------------------------------------------------- --Baixar versão minimal: http://isoredirect.centos.org/centos/7/isos/x86_64/ ------------------------------------------------------------------------------------------------------------------------------------------------------- --Configurando informações de IP fixo: --192.168.xxx.xxx é o ip do centos --192.168.yyy.yyy é o gateway da rede # vi /etc/sysconfig/network-scripts/ifcfg-eth0 ou em vm # vi /etc/sysconfig/network-scripts/ifcfg-ens33 (O tutorial foi feito em VMware) -------- editando arquivo --------- TYPE=Ethernet USE_DHCP=no BOOTPROTO=static IPADDR=192.168.xxx.xxx NETMASK=255.255.255.0 DEFROUTE=yes PEERDNS=yes PEERROUTERS=yes IPV4_FAILURE_FATAL=no IPV6INIT=no IPV6_AUTOCONF=no IPV6_DEFROUTE=no IPV6_PEERDNS=no IPV6_PEERROUTERS=no IPV6_FAILURE_FATAL=no NAME=ens33 UUID=xxxxxxxxxxxx verifica existente xxxxxxxxxxxxxxxxxxx DEVICE=ens33 ONBOOT=yes NM_CONTROLLED=no USERCTL=no ------------------------------------------------------------------------------------------------------------------------------------------------------- --Configurando o Hostname: # hostnamectl set-hostname samba # vi /etc/sysconfig/network -------- editando arquivo --------- NETWORKING="yes" HOSTNAME=rede.local HOSTNAME=samba.rede.local GATEWAY="192.168.yyy.yyy" ------------------------------------------------------------------------------------------------------------------------------------------------------- # vi /etc/hosts -------- editando arquivo --------- 127.0.0.1 samba.rede.local samba 192.168.xxx.xxx samba.rede.local samba ------------------------------------------------------------------------------------------------------------------------------------------------------- --Configurando DNS: # vi /etc/resolv.conf -------- editando arquivo --------- domain rede.local search rede.local nameserver 192.168.xxx.xxx nameserver 8.8.8.8 nameserver 208.67.222.222 ------------------------------------------------------------------------------------------------------------------------------------------------------- --Reinicie o servidor para certificar que todas as configurações subirão conforme configuradas. #reboot --A partir daqui use o putty para facilitar copiar e colar os comandos. --Atualizando o sistema e Instalando pacotes necessários: # yum update # yum install ntp nano vi wget curl net-tools lsof epel-release -y --Desabilitar o Selinux: # vi /etc/sysconfig/selinux SELINUX=disabled # setenforce 0 --Reinicie e confira se desabilitou o selinux. # reboot # sestatus SELinux status: disabled --Disabilitando servi.cos desnecessarios: # service firewalld stop # systemctl disable firewalld # service iptables stop # systemctl disable iptables # service ipv6tables stop # systemctl disable ipv6tables ------------------------------------------------------------------------------------------------------------------------------------------------------- --Configurando NTP Server: # vi /etc/ntp.conf -------- editando arquivo --------- #server 0.centos.pool.ntp.org iburst [comente esta linha] #server 1.centos.pool.ntp.org iburst [comente esta linha] #server 2.centos.pool.ntp.org iburst [comente esta linha] #server 3.centos.pool.ntp.org iburst [comente esta linha] server a.ntp.br iburst server b.ntp.br iburst server c.ntp.br iburst # Relogio Local server 127.127.1.0 fudge 127.127.1.0 stratum 10 # Configurações adicionais para o Samba 4 ntpsigndsocket /var/lib/samba/ntp_signd/ restrict default mssntp ------------------------------------------------------------------------------------------------------------------------------------------------------- --Iniciar e abilitar ntp: # systemctl start ntpd # systemctl enable ntpd --Verificar se está ok o ntp: # ntpq -p --Configurando horário: # ntpdate a.ntp.br ------------------------------------------------------------------------------------------------------------------------------------------------------- --Instalar todos os pacotes de dependências que o Samba 4 precisa para ser instalado: # yum install attr bind-utils docbook-style-xsl gcc gdb krb5-workstation libsemanage-python libxslt perl perl-ExtUtils-MakeMaker perl-Parse-Yapp perl-Test-Base pkgconfig policycoreutils-python python-crypto gnutls-devel libattr-devel keyutils-libs-devel libacl-devel libaio-devel libblkid-devel libxml2-devel openldap openldap-devel pam-devel popt-devel python-devel readline-devel zlib-devel systemd-devel setroubleshoot-server setroubleshoot-server setroubleshoot-plugins cups-devel ntp autoconf -y ------------------------------------------------------------------------------------------------------------------------------------------------------- --https://wiki.samba.org/index.php/Package_Dependencies_Required_to_Build_Samba --Instalando o SAMBA: # cd /usr/src/ # wget https://download.samba.org/pub/samba/stable/samba-4.7.4.tar.gz --no-check-certificate # tar xfvz samba-4.7.4.tar.gz # cd samba-4.7.4 # ./configure --enable-debug --enable-selftest --with-ads --with-systemd --with-winbind # make && make install [Aqui pode tirar uns 15 minutos para tomar um cafézinho] ------------------------------------------------------------------------------------------------------------------------------------------------------- --Atualizar o cache de bibliotecas dinâmicas: # ldconfig --Configurar kerberos: # vi /etc/krb5.conf -------- editando arquivo --------- # Configuration snippets may be placed in this directory as well # includedir /etc/krb5.conf.d/ [logging] default = FILE:/var/log/krb5libs.log kdc = FILE:/var/log/krb5kdc.log admin_server = FILE:/var/log/kadmind.log [libdefaults] dns_lookup_realm = false dns_lookup_kdc = true ticket_lifetime = 24h renew_lifetime = 7d forwardable = true rdns = false default_realm = REDE.LOCAL default_tgs_enctypes = arcfour-hmac-md5 des-cbc-crc des-cbc-md5 default_tkt_enctypes = arcfour-hmac-md5 des-cbc-crc des-cbc-md5 default_ccache_name = KEYRING:persistent:%{uid} [realms] REDE.LOCAL = { kdc = samba.rede.local admin_server = samba.rede.local default_domain = rede.local } [domain_realm] .rede.local = REDE.LOCAL rede.local = REDE.LOCAL ------------------------------------------------------------------------------------------------------------------------------------------------------- --Criar o link simbólico do comando samba-tool, para evitar o seguinte problema quando o comando abaixo for executado: # samba-tool domain provision --use-rfc2307 --interactive -bash: samba-tool: comando não encontrado # ln -sv /usr/local/samba/bin/samba-tool /bin/ --Configurando o samba como DC: # samba-tool domain provision --use-rfc2307 --interactive -------- editando arquivo --------- Realm [REDE.LOCAL]:REDE.LOCAL Domain [REDE]:REDE Server Role (dc, member, standalone) [dc]:dc DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]:SAMBA_INTERNAL DNS forwarder IP address (write 'none' to disable forwarding) [192.168.171.100]: 8.8.8.8 Administrator password:SENHA@23nessepadrao Retype password:SENHA@23nessepadrao ------------------------------------------------------------------------------------------------------------------------------------------------------- --Criando serviço do samba: # vi /etc/systemd/system/samba-dc.service -------- editando arquivo --------- [Unit] Description= Samba 4 Active Directory After=syslog.target After=network.target [Service] Type=forking PIDFile=/usr/local/samba/var/run/samba.pid ExecStart=/usr/local/samba/sbin/samba [Install] WantedBy=multi-user.target ------------------------------------------------------------------------------------------------------------------------------------------------------- --Reiniciar o daemon do SystemD: # systemctl daemon-reload --Ativando na inicialização do Sistema e Iniciando o Serviço: # systemctl enable samba-dc Created symlink from /etc/systemd/system/multi-user.target.wants/samba-dc.service to /etc/systemd/system/samba-dc.service. # systemctl start samba-dc --Verificando status do serviço: # systemctl status samba-dc -------- resultado do comando --------- ● samba-dc.service Loaded: loaded (/etc/systemd/system/samba-dc.service; enabled; vendor preset: disabled) Active: active (running) since Ter 2018-03-13 22:02:54 -03; 27s ago Process: 4145 ExecStart=/usr/local/samba/sbin/samba (code=exited, status=0/SUCCESS) Main PID: 4146 (samba) CGroup: /system.slice/samba-dc.service ├─4146 /usr/local/samba/sbin/samba ├─4147 /usr/local/samba/sbin/samba ├─4148 /usr/local/samba/sbin/samba ├─4149 /usr/local/samba/sbin/samba ├─4150 /usr/local/samba/sbin/samba ... ------------------------------------------------------------------------------------------------------------------------------------------------------- --Testando DNS # host -t SRV _ldap._tcp.rede.local -------- resultado do comando --------- _ldap._tcp.rede.local has SRV record 0 100 389 samba.rede.local. ------------------------------------------------------------------------------------------------------------------------------------------------------- # host -t SRV _kerberos._udp.rede.local -------- resultado do comando --------- _kerberos._udp.REDE.LOCAL has SRV record 0 100 88 samba.rede.local. ------------------------------------------------------------------------------------------------------------------------------------------------------- # host -t A samba.rede.local -------- resultado do comando --------- samba.rede.local has address 192.168.xxx.xxx ------------------------------------------------------------------------------------------------------------------------------------------------------- # nslookup samba.rede.local -------- resultado do comando --------- Server: 192.168.xxx.xxx Address: 192.168.xxx.xxx#53 Name: samba.rede.local Address: 192.168.xxx.xxx ------------------------------------------------------------------------------------------------------------------------------------------------------- --Ajustar a permissão para o servidor NTP acessar o socket do Samba: # chown root:ntp /usr/local/samba/var/lib/ntp_signd/ # systemctl restart ntpd --Veficando compartilhamento (sysvol e netlogon): --Para evitar o seguinte problema: # smbclient -L samba -U% -bash: smbclient: comando não encontrado --Criar o link simbólico do comando smbclient: # ln -sv /usr/local/samba/bin/smbclient /bin/ # smbclient -L container -U% -------- resultado do comando --------- Sharename Type Comment --------- ---- ------- netlogon Disk sysvol Disk IPC$ IPC IPC Service (Samba 4.7.4) Reconnecting with SMB1 for workgroup listing. Server Comment --------- ------- Workgroup Master --------- ------- ------------------------------------------------------------------------------------------------------------------------------------------------------- --Verificando configurações do Samba: # mkdir /etc/samba # ln -sv /usr/local/samba/etc/smb.conf /etc/samba/ -------- resultado do comando --------- “/etc/samba/smb.conf” -> “/usr/local/samba/etc/smb.conf” ------------------------------------------------------------------------------------------------------------------------------------------------------- --Adicionar novos compartilhamentos: --Se optar por Perfil móvel, criar a pasta em /usr/local/samba/var/profiles, aponte no arquivo /etc/samba/smb.conf: # mkdir /usr/local/samba/var/profiles # chmod -R775 /usr/local/samba/var/profiles # chown -R root:users /usr/local/samba/var/profiles --E sete no perfil de usuário do AD através das ferramentas do RSAT, lá no Windows, seguindo o caminho: Usuário > Propriedades de usuário > Perfil > Caminho do perfil \\ad\profiles\%USERNAME% --Criando e setando permissões da Lixeira: # mkdir /home/lixeira # chown root:users /home/lixeira # chmod 775 /home/lixeira -R --Criando o diretório de compartilhamento: --(Lembre-se de criar os seus próprios diretórios, como ex: DIRETORIA, RH, TECNICOS, etc) # mkdir /home/nomepasta # chmod 775 /home/nomepasta/ -R # chown root:users /home/nomedapasta/ -R ------------------------------------------------------------------------------------------------------------------------------------------------------- --Apontar o caminho no smb.conf: # vi /etc/samba/smb.conf -------- editando arquivo --------- # Global parameters [global] dns forwarder = 8.8.8.8 netbios name = SAMBA realm = REDE.LOCAL server role = active directory domain controller workgroup = REDE idmap_ldb:use rfc2307 = yes [netlogon] path = /usr/local/samba/var/locks/sysvol/REDE.LOCAL/scripts read only = No [sysvol] path = /usr/local/samba/var/locks/sysvol read only = No [profiles] path = /usr/local/samba/var/profiles comment = Perfil Movel read only = No # AUDITORIA vfs objects = full_audit full_audit:sucess = open, opendir, write, rename, mkdir, rmdir, chmod, chown full_audit:prefix = %U|%I|%S full_audit:failure = none full_audit:facility = local5 full_audit:priority = notice # LIXEIRA vfs objects = recycle recycle:keeptree = yes recycle:versions = yes recycle:repository = /home/lixeira/%U recycle:exclude = *.tmp, *.log, *.obj, ~*.*, *.bak, *.iso recycle:exclude_dir = tmp, cache # COMPARTILHAMENTOS [home] path = /home comment = home read only = No ------------------------------------------------------------------------------------------------------------------------------------------------------- --Restart samba: # systemctl restart samba-dc --Testando autenticação com kerberos: # kinit administrator@REDE.LOCAL -------- resultado do comando --------- Password for administrator@REDE.LOCAL: Warning: Your password will expire in 41 days on Ter 24 Abr 2018 19:00:04 -03 ------------------------------------------------------------------------------------------------------------------------------------------------------- # klist -------- resultado do comando --------- Ticket cache: KEYRING:persistent:0:0 Default principal: administrator@REDE.LOCAL Valid starting Expires Service principal 13-03-2018 22:26:07 14-03-2018 08:26:07 krbtgt/REDE.LOCAL@REDE.LOCAL renew until 20-03-2018 22:26:00 ------------------------------------------------------------------------------------------------------------------------------------------------------- -- Se todos os passos foram seguidos corretamente, o servidor deve está funcionando a contento, a partir de agora basta ingressar clientes no domínio. O Samba 4 possui os protocolos SMB versões 1, 2 e 3, sendo assim, permite qualquer cliente Windows. O SMB v1 é usado no Windows 2000, XP e 2003 Server; v2 pelo Vista e 2008 Server; v2.1 - Windows 7 e 2008 Server R2; v3 pelo Windows 8 e 2012 Server. Todo trabalho tem um custo, contribua com qualquer valor em minha carteira de Bitcoins: 13RbNMKewGwrbnwAKwT5hJA7XpugXFBhXV
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
Google Docs - Exploit
2 min ago | 0.28 KB
SwapEngine Bug [build 1.3]
29 min ago | 0.28 KB
December smells like money
CSS | 42 min ago | 0.28 KB
✅ Changelly.com Exploit
55 min ago | 0.28 KB
Untitled
C | 10 hours ago | 0.88 KB
acg
1 day ago | 0.05 KB
AI METHODS
2 days ago | 0.29 KB
Untitled
2 days ago | 0.29 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!