Fórum Ubuntu Linux - PT
Suporte Técnico => Servidores => Tópico iniciado por: botinha em 28 de Maio de 2014, 11:03
-
Caros amigos estou configurando um novo servidor e vim novamente "beber na fonte de conhecimento a comunidade". Quero deixar ele funcionando da seguinte maneira: (serviço de rede)--(Servidor com duas placas de rede)--(roteador wireless)--(estações de trabalho). Seguindo as dicas http://www.hardware.com.br/livros/servidores-linux/compartilhando-conexao.html estou com difiuldades de fazer as estações funcionarem com o dhcp.
O meu /etc/network está assim.
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo eth0 eth1
iface lo inet loopback
iface eth0 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
iface eth0 inet dhcp
O meu /etc/default/isc-dhcp-server ficou deste modo.
# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf
# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid
# Additional options to start dhcpd with.
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth0"
Deste modo o servidor está funcionado eu navego sem problemas mas as estações não.
Estou usando o Debian 7.
Valeuu
-
Pq vc não usa o servidor DHCP do roteador wireless? Basta ligar seu servidor à porta wan do roteador e deixá-lo trabalhar da melhor maneira que pode.
Do contrário, se for mesmo servir dhcp a partir do seu servidor, não esqueça de desabilitar o dhcp do roteador, ou ele vai te sacanear legal.
Outra coisa, pelo que vi das outras configurações, vc serve à rede interna pela eth1, não pela eth0. Então vc tem que mudar seu /etc/default/isc-dhcp-server de acordo.
Por fim, faltou vc passar a configuração do arquivo /etc/dhcp/dhcpd.conf, que faz toda a diferença nesse caso.
-
CAro zekkerj a ideia eh boa de deixar o roteador fazer todo o trabalho, mas esse servidor de dhcp eh para estudos e aperfeicoamento.
o o /etc/dchp/dhcpd.conf
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.199;
option routers 192.168.1.1;
option domain-name-servers 208.67.222.222,208.67.220.220;
option broadcast-address 192.168.1.255;
}
As estações ainda não pegaram o ip.
Valeu....
-
Corrigiu o arquivo /etc/default/isc-dhcp-server?
-
CAro zekkerj
ele está assim
Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf
# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid
# Additional options to start dhcpd with.
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth0"
ele deve ficar assim
Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf
# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid
# Additional options to start dhcpd with.
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth1"
-
Sim, isso mesmo. Você vai oferecer dhcp na eth1, não na eth0.
Não esqueça de reiniciar o serviço, ao alterar essa configuração.
sudo service isc-dhcp-server restart
-
CAro zekkerj , agora as coisas parecem tomar rumo por aqui, agora as estações começam a pegar ip deixei os arquivos dessa maneira:
/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo eth0 eth1
iface lo inet loopback
iface eth1 inet static
address 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
iface eth0 inet dhcp
o /etc/default/isc-dhcp-server
# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf
# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid
# Additional options to start dhcpd with.
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth0"
Porém não consigo navegar na web nas estações.
o /etc/rc.local está assim compartilhando.
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
iptables -A INPUT -m state --state INVALID -j DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --syn -j DROP
VAleuu
-
exit 0
Esse comando termina o script. Seus comandos têm que ficar antes dele, pra serem interpretados.
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --syn -j DROP
Não esqueça que sua eth0 é a internet, não a rede local. Vc vai mesmo abrir tudo pra internet e não abrir pra rede local?
-
Caro zekkerj
Acho que eu tive um erro no /etc/default/isc-dhcp-server eu tinha postado que estava na eth0, ai no servidor para de pagar ip. Eu coloquei eth1 ai funcionou.
Sobre o compartilhamento ficou da seguinte maneira.
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
iptables -A INPUT -m state --state INVALID -j DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth1 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --syn -j DROP
exit 0
Até ai tudo agora rodando conforme o esperado, as estações estão funcionando e navegando na web com dhcp. òtimo
Agora lapidando melhor o servidor eu gostaria de usar squid que eu com a sua propria ajuda aqui no forum configuramos para o antigo servidor nesse tópico http://ubuntuforum-br.org/index.php/topic,102613.msg565812.html#msg565812.
Eu deixei ele dessa maneira.
#porta do squid
http_port 3128
# nome do servidor
visible_hostname servidor
# mensagens de erro em português
error_directory /usr/share/squid3/errors/pt-br
# cache
cache_mem 64 MB
maximum_object_size_in_memory 128 KB
maximum_object_size 512 MB
cache_dir ufs /var/spool/squid 4096 16 256
# logs de acesso
cache_access_log /var/log/squid/access.log
# autenticação de usuários
auth_param basic realm seja bem vindo ao servidor!
auth_param basic program /usr/lib/squid3/ncsa_auth /etc/squid3/squid_passwd
acl autenticados proxy_auth REQUIRED
#bloqueio por usuário
acl paiemae proxy_auth "/etc/squid3/paiemae"
acl filho proxy_auth "/etc/squid3/filho"
acl controle_filho url_regex -i "/etc/squid3/controle_filho"
http_access allow paiemae
http_access deny !controle_filho filho
# regras acl padrão
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255
acl SSL_ports port 443 563
acl Safe_ports port 80 21 280 443 488 563 591 777 1025-65535
acl purge method PURGE
acl CONNECT method CONNECT
# permissões e bloqueios padrão
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
# bloqueio e permissão de sites por MAC ADDRESS
acl macs_livres arp "/etc/squid3/mac.address"
# bloqueio de usuários fora da rede
# permissões e bloqueios padrão
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
# permissão rede local e servidor
acl redelocal src 192.168.1.0/24
http_access deny !macs_livres
http_access allow !redelocal
http_access allow autenticados
http_access deny all
e quando vou reiniciar o serviço eu recebo essas mensagens de erros.
[....] Restarting Squid HTTP Proxy 3.x: squid3/etc/init.d/squid3: 72: cd: can't cd to /var/spool/squid
2014/05/29 00:42:19| cache_cf.cc(381) parseOneConfigFile: squid.conf:1 unrecognized: 'squid'
2014/05/29 00:42:19| ERROR: '0.0.0.0/0.0.0.0' needs to be replaced by the term 'all'.
2014/05/29 00:42:19| SECURITY NOTICE: Overriding config setting. Using 'all' instead.
2014/05/29 00:42:19| WARNING: (B) '::/0' is a subnetwork of (A) '::/0'
2014/05/29 00:42:19| WARNING: because of this '::/0' is ignored to keep splay tree searching predictable
2014/05/29 00:42:19| WARNING: You should probably remove '::/0' from the ACL named 'all'
2014/05/29 00:42:19| WARNING: Netmasks are deprecated. Please use CIDR masks instead.
2014/05/29 00:42:19| WARNING: IPv4 netmasks are particularly nasty when used to compare IPv6 to IPv4 ranges.
2014/05/29 00:42:19| WARNING: For now we will assume you meant to write /32
failed!
Valeuuu
-
A primeira mensagem dá conta de que vc está usando squid3, e o diretório em vez de "/var/spool/squid" deve ser então "/var/spool/squid3" também. O mesmo deve acontecer com o diretório "/var/log/squid", confirme se não mudou pra "/var/log/squid3" também, se for o caso corrija sua configuração.
Esse erro na linha 1 ("unrecognized squid") eu não entendi. Precisaria ver de novo sua configuração.
Por fim, a mensagem sobre a acl "all", essa acl agora é interna. Retire a linha onde vc a define.
-
Caro
Fiz as mudanças que vou me orientou mais reiniciando o serviço do squid tenha essa mensagem:
[....] Restarting Squid HTTP Proxy 3.x: squid3/etc/init.d/squid3: 72: cd: can't cd to /var/spool/squid
2014/05/29 17:24:43| cache_cf.cc(381) parseOneConfigFile: squid.conf:1 unrecognized: 'squid'
2014/05/29 17:24:43| WARNING: Netmasks are deprecated. Please use CIDR masks instead.
2014/05/29 17:24:43| WARNING: IPv4 netmasks are particularly nasty when used to compare IPv6 to IPv4 ranges.
2014/05/
Valeuu...
-
A mensagem dá conta de que vc não alterou a configuração que eu disse...
-
CAro zekkerj
Ato falho a mensagem eh a seguinte:
[....] Restarting Squid HTTP Proxy 3.x: squid3[....] Creating Squid HTTP Proxy 3[warnche structure ... (warning).
2014/05/29 18:04:15| cache_cf.cc(381) parseOneConfigFile: squid.conf:1 unrecognized: 'squid'
2014/05/29 18:04:15| cache_cf.cc(381) parseOneConfigFile: squid.conf:1 unrecognized: 'squid'
failed!
VAleu...
-
Experimenta apagar a primeira linha do seu arquivo de configuração ("#porta do squid").
-
Caro zekkerj agora está funcionando perfeitamente, o problema era que no início do arquivo squid.conf eu tinha deixado um linha sem # no qual eu tinha colocado o meu nome e data de modificação do arquivo. Agora todas as estações navegam sem problemas. Mas em teste aqui eu resolvi tirar o proxy do navegador e a estação continuou a acessar a internet. O que pode estar permitindo esse acesso, segue o meu squid.conf agora devidamente configurado.
# modificado em 26/mai/2014 02:30h
#porta do squid
http_port 3128
# nome do servidor
visible_hostname servidor
# mensagens de erro em português
error_directory /usr/share/squid3/errors/pt-br
# cache
cache_mem 64 MB
maximum_object_size_in_memory 128 KB
maximum_object_size 512 MB
cache_dir ufs /var/spool/squid3 4096 16 256
# logs de acesso
cache_access_log /var/log/squid3/access.log
# autenticação de usuários
auth_param basic realm seja bem vindo ao servidor!
auth_param basic program /usr/lib/squid3/ncsa_auth /etc/squid3/squid_passwd
acl autenticados proxy_auth REQUIRED
#bloqueio por usuário
acl paiemae proxy_auth "/etc/squid3/paiemae"
acl filho proxy_auth "/etc/squid3/filho"
acl controle_filho url_regex -i "/etc/squid3/controle_filho"
http_access allow paiemae
http_access deny !controle_filho filho
# regras acl padrão
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl SSL_ports port 443 563 873
acl Safe_ports port 80 21 280 443 488 563 591 777 1025-65535
acl purge method PURGE
acl CONNECT method CONNECT
# permissões e bloqueios padrão
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
# bloqueio e permissão de sites por MAC ADDRESS
acl macs_livres arp "/etc/squid3/mac.address"
# bloqueio de usuários fora da rede
# permissões e bloqueios padrão
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
# permissão rede local e servidor
acl redelocal src 192.168.1.0/24
http_access deny !macs_livres
http_access allow !redelocal
http_access allow autenticados
http_access deny all
VAleuuu
-
A solução para o meu problema era o /etc/rc.local que não estava configurado corretamente. A resolução foi a seguinte:
Citação do http://www.hardware.com.br/livros/servidores-linux/instalando-squid.html
Caso necessário, abra a porta 3128 na configuração do firewall, para que o Squid possa receber as conexões. Um exemplo de regra manual do Iptables para abrir a porta do Squid apenas para a rede local (a interface eth0 no exemplo) é:
iptables -A INPUT -i eth0 -p tcp --dport 3128 -j ACCEPT
Então o arquivo ficou dessa maneira.
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -A INPUT -i eth1 -p tcp --dport 3128 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type echo-request -j DROP
echo 1 > /proc/sys/net/ipv4/conf/default/rp_filter
iptables -A INPUT -m state --state INVALID -j DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -i eth0 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp --syn -j DROP
exit 0
Às vezes a falta de atenção nos deixa louco é só prestar mais atenção no detalhe para não errar deste modo o estudo fica fixado.
Valeuu
-
Quem deixa passar é o firewall. Basta desativar o compartilhamento da conexão, e a única forma de sair será o squid.
-
Caro zekkerj com essa configuração que estah, digamos ficou legal, eficiente e elegante?
Valeuuuu.
-
Sempre tem alguma coisa que "eu" faria diferente. Mas o importante é que funcione corretamente, e que você entenda como está funcionando, para poder alterar o que precisar.
-
Concordo plenamente com a sua afirmativa, deste modo operante sei exatemente o que está sendo realizado no servidor. Bem aproveitando o tópico tem mais uma configuração que ainda não está funcionando e eu estou um pouco confuso mesmo lendo alguns artigos sobre o o tema. O compartilhamento de impressoras,0 eu tenhoum note Macbook que foi fácil instalar a impressora configurado pelo Cups ele rapidamente me dava a opção da impressora, porém em um notebook com Windows Vista instalado eu nõa consegui instalar. Segue o meu smb.conf e o cuspd.conf
smb.conf
#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
# - When such options are commented with ";", the proposed setting
# differs from the default Samba behaviour
# - When commented with "#", the proposed setting is the default
# behaviour of Samba but the option is considered important
# enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic
# errors.
# A well-established practice is to name the original file
# "smb.conf.master" and create the "real" config file with
# testparm -s smb.conf.master >smb.conf
# This minimizes the size of the really used smb.conf file
# which, according to the Samba Team, impacts performance
# However, use this with caution if your smb.conf file contains nested
# "include" statements. See Debian bug #483187 for a case
# where using a master file is not a good idea.
#
#======================= Global Settings =======================
[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = WORKGROUP
# server string is the equivalent of the NT Description field
server string = %h server
# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
# wins support = no
# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
; wins server = w.x.y.z
# This will prevent nmbd to search for NetBIOS names through DNS.
dns proxy = no
# What naming service and in what order should we use to resolve host names
# to IP addresses
; name resolve order = lmhosts host wins bcast
#### Networking ####
# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
; interfaces = 127.0.0.0/8 eth0
# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself. However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
; bind interfaces only = yes
#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m
# Cap the size of the individual log files (in KiB).
max log size = 1000
# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
# syslog only = no
# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
syslog = 0
# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d
####### Authentication #######
# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
# security = user
# You may wish to use password encryption. See the section on
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
encrypt passwords = true
# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
passdb backend = tdbsam
obey pam restrictions = yes
# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
unix password sync = yes
# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
pam password change = yes
# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
map to guest = bad user
########## Domains ###########
# Is this machine able to authenticate users. Both PDC and BDC
# must have this setting enabled. If you are the BDC you must
# change the 'domain master' setting to no
#
; domain logons = yes
#
# The following setting only takes effect if 'domain logons' is set
# It specifies the location of the user's profile directory
# from the client point of view)
# The following required a [profiles] share to be setup on the
# samba server (see below)
; logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
# logon path = \\%N\%U\profile
# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
; logon drive = H:
# logon home = \\%N\%U
# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
; logon script = logon.cmd
# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe. The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u
# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# The following assumes a "machines" group exists on the system
; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.
; add group script = /usr/sbin/addgroup --force-badname %g
########## Printing ##########
# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
# load printers = yes
# lpr(ng) printing. You may wish to override the location of the
# printcap file
; printing = bsd
; printcap name = /etc/printcap
# CUPS printing. See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
; printing = cups
; printcap name = cups
############ Misc ############
# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
; include = /home/samba/etc/smb.conf.%m
# Most people will find that this option gives better performance.
# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/speed.html
# for details
# You may want to add the following on a Linux system:
# SO_RCVBUF=8192 SO_SNDBUF=8192
# socket options = TCP_NODELAY
# The following parameter is useful only if you have the linpopup package
# installed. The samba maintainer and the linpopup maintainer are
# working to ease installation and configuration of linpopup and samba.
; message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &
# Domain Master specifies Samba to be the Domain Master Browser. If this
# machine will be configured as a BDC (a secondary logon server), you
# must set this to 'no'; otherwise, the default behavior is recommended.
# domain master = auto
# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
; idmap uid = 10000-20000
; idmap gid = 10000-20000
; template shell = /bin/bash
# The following was the default behaviour in sarge,
# but samba upstream reverted the default because it might induce
# performance issues in large organizations.
# See Debian bug #368251 for some of the consequences of *not*
# having this setting and smb.conf(5) for details.
; winbind enum groups = yes
; winbind enum users = yes
# Setup usershare options to enable non-root users to share folders
# with the net usershare command.
# Maximum number of usershare. 0 (default) means that usershare is disabled.
; usershare max shares = 100
# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
usershare allow guests = yes
#======================= Share Definitions =======================
[homes]
comment = Home Directories
browseable = no
# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
read only = yes
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
create mask = 0700
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
directory mask = 0700
# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# The following parameter makes sure that only "username" can connect
# to \\server\username
# This might need tweaking when using external authentication schemes
valid users = %S
# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes
# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
; write list = root, @lpadmin
# A sample share for sharing your CD-ROM with others.
;[cdrom]
; comment = Samba server's CD-ROM
; read only = yes
; locking = no
; path = /cdrom
; guest ok = yes
# The next two parameters show how to auto-mount a CD-ROM when the
# cdrom share is accesed. For this to work /etc/fstab must contain
# an entry like this:
#
# /dev/scd0 /cdrom iso9660 defaults,noauto,ro,user 0 0
#
# The CD-ROM gets unmounted automatically after the connection to the
#
# If you don't want to use auto-mounting/unmounting make sure the CD
# is mounted on /cdrom
#
; preexec = /bin/mount /cdrom
; postexec = /bin/umount /cdrom
/etc/cups/cupsd.conf
# Show troubleshooting information in error_log.
LogLevel debug
MaxLogSize 0
# Allow remote access
Port 631
Listen /var/run/cups/cups.sock
# Enable printer sharing and shared printers.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
BrowseRemoteProtocols CUPS dnssd
BrowseAddress @LOCAL
BrowseLocalProtocols CUPS dnssd
DefaultAuthType Basic
WebInterface Yes
<Location />
# Allow shared printing...
Order allow,deny
Allow @LOCAL
</Location>
<Location /admin>
Order allow,deny
</Location>
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
</Location>
<Policy default>
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
<Limit Create-Job Print-Job Print-URI Validate-Job>
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
<Policy authenticated>
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
<Limit Create-Job Print-Job Print-URI Validate-Job>
AuthType Default
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Default
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
VAleu...
-
########## Printing ##########
# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
# load printers = yes
# lpr(ng) printing. You may wish to override the location of the
# printcap file
; printing = bsd
; printcap name = /etc/printcap
# CUPS printing. See also the cupsaddsmb(Legal manpage in the
# cupsys-client package.
; printing = cups
; printcap name = cups
Eu acho que a chave está aqui, eu entendo que esses parâmetros "load printers = yes" e "printing = cups" devem ser ativados (ou seja, retirar o "#" ou o ";" do início da linha.
-
CAro zekkerj sem sucesso na tentativa de funcionar o compartilhamento de impressora, no notebook que tem Windows, na dica que você postou quando eu descomento as opções eu não consigo nenhum acesso ao cups na estação windows browser.
########## Printing ##########
# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
load printers = yes
# lpr(ng) printing. You may wish to override the location of the
# printcap file
; printing = bsd
; printcap name = /etc/printcap
# CUPS printing. See also the cupsaddsmb(Legal manpage in the
# cupsys-client package.
printing = cups
; printcap name = cups
O que me deixa intrigado é com o Macbook a impressora funciona perfeitamente.
Valeuuu..
-
Vc não vai acessar o cups, vai acessar como uma impressora do windows.
Não esqueça de reiniciar o samba depois de mexer nos parâmetros.
-
Caro zekkerj fiz exatamente o que vc informou e não consegui sucesso, deixe sem os comentários e reiniciei o serviço.
Valeuu
-
Dentro do contexto em tenho um outra dúvida ele que local do meu squid.conf eu coloco uma acl para liberar determinados ips para não passar pelo proxy.
Valeuuu
-
Consegue pelo menos visualizar a máquina Linux, no windows, e listar os compartilhamentos oferecidos?
-
Consegue pelo menos visualizar a máquina Linux, no windows, e listar os compartilhamentos oferecidos?
Com essa configuração que estah no Windows eu não visualizo nada.
Valeeeeu
-
Compartilhamento nenhum? Está aí seu problema. Vc está passando um usuário válido pro Samba?
-
Bom então devo fazer todos os compartilhametos, deste modo para impressora funcionar?
Compartilhamento nenhum? sim
Vc está passando um usuário válido pro Samba? creio que sim também.
VAleu......
-
Estou revendo seus parâmetros, tenho quase certeza do problema estar associado a vc não ter um usuário válido no Samba.
Vc chegou a criar um usuário pra vc com o comando "smbpasswd"? Se não criou, é pq esse usuário não existe; e tanto o share "Printers", que tem a lista das impressoras, quanto o Print$, que tem os drivers, estão marcados para não aceitar acesso anônimo.
-
Caro zekkerj realmente eu não criei usuário para o samba, talvez o Macbook ter conseguido visualizar a impressora no servidor eu instalar a mesma e realizar as impressões deve ter me induzido ao erro achando que o no Windows iria funcionar nos mesmo modos.
Valeuuu...
-
Aqui no servidor está tudo funcionando eu consigo acessar o diretório compartilhado, vejo e acesso o compartilhameno além de tudo criei o usuário do samba. Porém na máquina Windows que está com o Vista eu não consigo ter acesso a nada que foi configurado. Segue o meu smb.conf. No final do arquivo eu criei um compartilhamento soh para testar e funciona, apenas o servidor.
Valeuu...
#
# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
# - When such options are commented with ";", the proposed setting
# differs from the default Samba behaviour
# - When commented with "#", the proposed setting is the default
# behaviour of Samba but the option is considered important
# enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic
# errors.
# A well-established practice is to name the original file
# "smb.conf.master" and create the "real" config file with
# testparm -s smb.conf.master >smb.conf
# This minimizes the size of the really used smb.conf file
# which, according to the Samba Team, impacts performance
# However, use this with caution if your smb.conf file contains nested
# "include" statements. See Debian bug #483187 for a case
# where using a master file is not a good idea.
#
#======================= Global Settings =======================
[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = casa
netbios name = servidor
# server string is the equivalent of the NT Description field
server string = %h server
# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
# wins support = no
# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
; wins server = w.x.y.z
# This will prevent nmbd to search for NetBIOS names through DNS.
dns proxy = no
# What naming service and in what order should we use to resolve host names
# to IP addresses
; name resolve order = lmhosts host wins bcast
#### Networking ####
# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
; interfaces = 127.0.0.0/8 eth0
# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself. However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
; bind interfaces only = yes
#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m
# Cap the size of the individual log files (in KiB).
max log size = 1000
# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
# syslog only = no
# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
syslog = 0
# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d
####### Authentication #######
# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
security = user
# You may wish to use password encryption. See the section on
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
encrypt passwords = true
# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
passdb backend = tdbsam
obey pam restrictions = yes
# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
unix password sync = yes
# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan <<kahan@informatik.tu-muenchen.de> for
# sending the correct chat script for the passwd program in Debian Sarge).
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
pam password change = yes
# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
map to guest = bad user
########## Domains ###########
# Is this machine able to authenticate users. Both PDC and BDC
# must have this setting enabled. If you are the BDC you must
# change the 'domain master' setting to no
#
; domain logons = yes
#
# The following setting only takes effect if 'domain logons' is set
# It specifies the location of the user's profile directory
# from the client point of view)
# The following required a [profiles] share to be setup on the
# samba server (see below)
; logon path = \\%N\profiles\%U
# Another common choice is storing the profile in the user's home directory
# (this is Samba's default)
# logon path = \\%N\%U\profile
# The following setting only takes effect if 'domain logons' is set
# It specifies the location of a user's home directory (from the client
# point of view)
; logon drive = H:
# logon home = \\%N\%U
# The following setting only takes effect if 'domain logons' is set
# It specifies the script to run during logon. The script must be stored
# in the [netlogon] share
# NOTE: Must be store in 'DOS' file format convention
; logon script = logon.cmd
# This allows Unix users to be created on the domain controller via the SAMR
# RPC pipe. The example command creates a user account with a disabled Unix
# password; please adapt to your needs
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u
# This allows machine accounts to be created on the domain controller via the
# SAMR RPC pipe.
# The following assumes a "machines" group exists on the system
; add machine script = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
# This allows Unix groups to be created on the domain controller via the SAMR
# RPC pipe.
; add group script = /usr/sbin/addgroup --force-badname %g
########## Printing ##########
# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
load printers = yes
# lpr(ng) printing. You may wish to override the location of the
# printcap file
; printing = bsd
; printcap name = /etc/printcap
# CUPS printing. See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
printing = cups
printcap name = cups
############ Misc ############
# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting
; include = /home/samba/etc/smb.conf.%m
# Most people will find that this option gives better performance.
# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/speed.html
# for details
# You may want to add the following on a Linux system:
# SO_RCVBUF=8192 SO_SNDBUF=8192
# socket options = TCP_NODELAY
# The following parameter is useful only if you have the linpopup package
# installed. The samba maintainer and the linpopup maintainer are
# working to ease installation and configuration of linpopup and samba.
; message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &
# Domain Master specifies Samba to be the Domain Master Browser. If this
# machine will be configured as a BDC (a secondary logon server), you
# must set this to 'no'; otherwise, the default behavior is recommended.
# domain master = auto
# Some defaults for winbind (make sure you're not using the ranges
# for something else.)
; idmap uid = 10000-20000
; idmap gid = 10000-20000
; template shell = /bin/bash
# The following was the default behaviour in sarge,
# but samba upstream reverted the default because it might induce
# performance issues in large organizations.
# See Debian bug #368251 for some of the consequences of *not*
# having this setting and smb.conf(5) for details.
; winbind enum groups = yes
; winbind enum users = yes
# Setup usershare options to enable non-root users to share folders
# with the net usershare command.
# Maximum number of usershare. 0 (default) means that usershare is disabled.
; usershare max shares = 100
# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
usershare allow guests = yes
#======================= Share Definitions =======================
[homes]
comment = Home Directories
browseable = no
# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
read only = yes
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
create mask = 0700
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
directory mask = 0700
# By default, \\server\username shares can be connected to by anyone
# with access to the samba server.
# The following parameter makes sure that only "username" can connect
# to \\server\username
# This might need tweaking when using external authentication schemes
valid users = %S
# Un-comment the following and create the netlogon directory for Domain Logons
# (you need to configure Samba to act as a domain controller too.)
;[netlogon]
; comment = Network Logon Service
; path = /home/samba/netlogon
; guest ok = yes
; read only = yes
# Un-comment the following and create the profiles directory to store
# users profiles (see the "logon path" option above)
# (you need to configure Samba to act as a domain controller too.)
# The path below should be writable by all users so that their
# profile directory may be created the first time they log on
;[profiles]
; comment = Users profiles
; path = /home/samba/profiles
; guest ok = no
; browseable = no
; create mask = 0600
; directory mask = 0700
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = yes
read only = yes
create mask = 0700
# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
# Uncomment to allow remote administration of Windows print drivers.
# You may need to replace 'lpadmin' with the name of the group your
# admin users are members of.
# Please note that you also need to set appropriate Unix permissions
# to the drivers directory for these users to have write rights in it
; write list = root, @lpadmin
# A sample share for sharing your CD-ROM with others.
;[cdrom]
; comment = Samba server's CD-ROM
; read only = yes
; locking = no
; path = /cdrom
; guest ok = yes
# The next two parameters show how to auto-mount a CD-ROM when the
# cdrom share is accesed. For this to work /etc/fstab must contain
# an entry like this:
#
# /dev/scd0 /cdrom iso9660 defaults,noauto,ro,user 0 0
#
# The CD-ROM gets unmounted automatically after the connection to the
#
# If you don't want to use auto-mounting/unmounting make sure the CD
# is mounted on /cdrom
#
; preexec = /bin/mount /cdrom
; postexec = /bin/umount /cdrom
[compartilhamento]
path = /home/servidor/compartilhamento
available = yes
browseable = yes
writable = yes
-
Criou o usuário com o mesmo nome que existe no windows?
Criou o usuário no Linux e no Samba? Os comandos pra isso são:
adduser usuario
smbpasswd -a usuario
-
Aqui me surgiu uma dúvida que usuário êh esse que devo criar no Windows?
Criou o usuário no Linux e no Samba? Os comandos pra isso são:
Sim eu criei o usuário.
Usuário user, depois coloquei a senha .
No servidor eu consigo acessar o compartilhamento ele me solicita a senha e eu consigo entrar nos diretórios.
A respeito do smb.conf ele estah correto?
Caro zekkerj eu estou usando um proxy serah que êh esse o motivo de não funcionar? Se positivo devo mudar alguma conf no smb.conf.
Valeuuuu
Valeuuuu..
-
Não deveria haver problema com proxy, proxy só interfere no navegador e em serviços que usem HTTP --- que não é o caso do cups nem do Samba.
Não vejo nada de errado em seu smb.conf, numa inspeção rápida. Talvez vc deva aumentar o nível de log e acompanhar o motivo de não funcionar.
PS: Vc não disse se já consegue ver pelo menos o compartilhamento.
-
Caro zekkerj a respeito do compartilhamento eu não consigo visualizar ele no Windows.
Eu vou no executar e digito \\servidor e não consigo acesso.
Valeuuuu.
-
E os logs do samba, já consultou?
-
Depois de muito tempo sem poder trabalhar na minha estação por razões particulares, estou retomando os trabalhos.
zekkerj como fazer para consultar os log do samba.??
VAleu...
-
Primeiro aumente o nível de log, adicionando a linha abaixo ao arquivo smb.conf.
log level = 3
Depois consulte os logs em /var/log/samba.
-
Como eu faço para que o servidor distribua a internet e no caso seria speedy da telefonica que precisa de um comctador pppoe dsl como fazer isso e continuar a configuração dhcp ?
-
O que tem o urubu a ver com as calças??? O que tem sua pergunta a ver com o resto do tópico?
-
O topico fala de dhcp em duas placas de rede uma entranda internet e outra da rede, quera saber quando fazer a conexão via pppoe vou ter que mudar eth0 no compartilhamento da internet? E como faço para ele conectar automático?