[Samba] Samba printer management commands

Juan Asensio Sánchez okelet at gmail.com
Thu Dec 16 02:30:39 MST 2010


Well, I realized that the script is not executed, neither the printer
created... I am stuck. This is the complete configuration:

[global]
        unix charset = LOCALE
        workgroup = XXXXXXXXXXXX
        netbios name = XXXXXXXXXXXXXXXX
        server string = Controlador de dominio %h de %D
        passdb backend = ldapsam:ldaps://XXXXXXXXXXX
        log level = 2
        syslog = 0
        log file = /var/log/samba/%m.trace
        max log size = 1000
        time server = Yes
        socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

# Opciones de gestión de recursos compartidos
add share command    = /bin/bash /opt/ldap/samba/smb_share_add.sh
change share command = /bin/bash /opt/ldap/samba/smb_share_add.sh
delete share command = /bin/bash /opt/ldap/samba/smb_share_del.sh

# Opciones de gestión de impresión
add printer command    = /bin/bash /opt/ldap/samba/smb_printer_add.sh
delete printer command = /bin/bash /opt/ldap/samba/smb_printer_del.sh
printcap cache time   = 60

        logon script = logon.cmd
        logon path =
        logon home =
        domain logons = Yes

        os level = 65
        preferred master = Yes
        domain master = Yes
        wins support = Yes
        name resolve order = wins lmhosts hosts bcast

        ldap admin dn = XXXXXXXXXXXXXXX
        ldap group suffix = XXXXXXXXXXXXXXXX
        ldap machine suffix = XXXXXXXXXXXXXXX
        ldap passwd sync = Yes
        ldap suffix = XXXXXXXXXXXXX
        ldap ssl = Off
        template shell = /bin/bash
        invalid users = root
        map acl inherit = yes
        ntlm auth = yes
        enable privileges = yes

[homes]
comment = Directorio personal del usuario %u
root preexec = /bin/bash /opt/ldap/samba/mkhomedir.sh %u
read only = no


[printers]
comment = Impresoras
path = /var/spool/samba
printing = cups
printable = yes


[print$]
comment = Controladores de impresión
path = /var/lib/samba/printing
read only = no

Regards and thanks in advance.

El día 16 de diciembre de 2010 10:15, Juan Asensio Sánchez
<okelet at gmail.com> escribió:
> Hi
>
> I am trying to setup remote printer management commands, so the users
> could add and delete printers from "Printers" share of Samba in
> Windows. I have this script, that is launched using an administrator
> account, when I add a printer from there, using a new TCP/IP port:
>
> ================================================================
>
> #!/bin/bash
>
> {
>
>        ##########################################################################
>        # Parámetros
>        ##########################################################################
>
>        # Nombre de la impresora
>        LPNAME=$(echo "$1" | iconv -t ascii//translit | sed --regexp-extended
> 's/\s+/_/g')
>
>        # Nombre del recurso compartido
>        SHARENAME=$2
>
>        # Nombre del puerto
>        PORTNAME=$3
>
>        # Nombre del controlador
>        DRIVERNAME=$4
>
>        # Localización
>        LOCATION_OLD=$5
>
>        # Localización en Windows 95
>        LOCATIONWIN9X=$6
>
>        # Comprobar la sintaxis de la localización, y añadir el protocolo por
> defecto si no lo tiene
>        if [[ ! ${LOCATION_OLD} =~ ":/" ]]
>        then
>                LOCATION_NEW="lpd://${LOCATION_OLD}"
>        else
>                LOCATION_NEW="${LOCATION_OLD}"
>        fi
>
>        # Mostrar mensaje
>        echo "Añadiendo impresora. Nombre: $1 (${LPNAME}); recurso:
> ${SHARENAME}; puerto: ${PORTNAME}; driver: ${DRIVERNAME};
> localización: ${LOCATION_OLD} (${LOCATION_NEW}); localización Win9X:
> ${LOCATIONWIN9X}..."
>
>        # Añadir la impresora
>        /usr/sbin/lpadmin -p "${SHARENAME}" -D "${DRIVERNAME}" -E -v "${LOCATION_NEW}"
>
>
>        # Recargar la configuración de Samba
>        /etc/init.d/smb reload
>
> } 2>&1 | logger -t SMB_PRINTER_ADD
>
> ================================================================
>
> The printer is recognized correctly in the wizard, but when I press
> the Finish button, i get ever "Access denied", although the printer
> has been created correctly in /etc/printcap. What am I doing wrong?
>
> Regards.
>


More information about the samba mailing list