# cupsaddsmb - setdriver WERR_ACCESS_DENIED

## skarecrow

Hi, I'm trying to setup a Samba/CUPS print server in a Win2k Active Directory environment. I'm setting up a linux box to replace windows file/print servers in our sales offices. 

I have the active directory authentication working against our PDC which is running Windows Services for Unix. As far as the file sharing and AD authentication are concerned, I'm done. Those parts work beautifully. My problem now is setting up the point-n-print driver installation for our windows xp clients. I have a copier installed on the CUPS server and it has the proper CUPS driver. I can print from Linux and I can see the printer share from my Windows machines. I have followed a dozen or more walkthroughs on setting up the windows printer drivers for point-n-print using "cupsaddsmb" yet it fails every time on the last step when it tries to do rpcclient -c 'setdriver copier copier'. 

I get an error stating

```
SetPrinter call failed!

result was WERR_ACCESS_DENIED

```

Here is my smb.conf 

```

[global]

        workgroup = AGIVYP

        realm = AGIVYP.COM

        security = ads

        auth methods = winbind

        password server = 192.168.1.9 192.168.1.10 *

        disable netbios = Yes

        socket options = TCP_NODELAY SO_RCVBUF=16384 SO_SNDBUF=16384

        printing = cups

        printcap name = cups

        idmap backend = ad

        idmap uid = 10000-100000

        idmap gid = 10000-200000

        template homedir = /home/%U

        log level = 1

        winbind separator = \

        winbind enum users = Yes

        winbind enum groups = Yes

        winbind use default domain = Yes

        winbind nss info = sfu

        winbind refresh tickets = Yes

        create mode = 0770

        directory mode = 0770

        cups options = raw

        hide unreadable = Yes

        load printers = yes

        hide dot files = yes

        admin users = adamr, root

[User]

        path = /mnt/User/

        read only = No

        force group = "domain users"

[Public]

        path = /mnt/User/Public

        read only = No

        force group = "domain users"

[driver]

        path = /mnt/Printers

        read only = yes

[printers]

        comment = Printers on Salestest

        path = /var/spool/samba

        browseable = no

        printer admin = root

        admin users = root, adamr, @"enterprise admins"

        printable = Yes

        public = yes

        guest ok = yes

        writable = no

        write list = root, adamr, @"enterprise admins"

[print$]

        comment = Printer Drivers

        path = /etc/samba/drivers

        browseable = yes

        guest ok = no

        read only = no

        writable = yes

        write list = adamr, root, @"enterprise admins"

        admin users = root, @"enterprise admins"

[IS_COP]

        comment = Toshiba 2500C Copier

        path = /var/spool/samba

        public = yes

        printable = yes

        admin users = root, @"enterprise admins"

        use client driver = yes

        printer admin = root

```

I've changed my smb.conf about 100 times since starting this project, trying various lines to see if things will work, so it may be messier than it needs to be.

When I run 

```
cupsaddsmb -U adamr -v -a -H servertest -h servertest
```

 it goes through the first two steps just fine. It creates the windows driver folder structure in the print$ share and copies over the appropriate drivers. It also successfully installs the driver. Cupsaddsmb fails on the last step which is an rpc call, it basically runs 

```
rpcclient -U adamr -c 'setdriver IS_COP IS_COP'
```

Thats when I get the WERR_ACCESS_DENIED error. 

```
servertest ~ # cupsaddsmb -U adamr -v -a -H servertest -h servertest

Password for adamr required to access servertest via SAMBA:

Running command: smbclient //servertest/print$ -N -A /var/spool/cups/tmp/4669a0bc1a9a2 -c 'mkdir W32X86;put /var/spool/cups/tmp/4669a0b9b5292 W32X86/IS_COP.ppd;put /usr/share/cups/drivers/ps5ui.dll W32X86/ps5ui.dll;put /usr/share/cups/drivers/pscript.hlp W32X86/pscript.hlp;put /usr/share/cups/drivers/pscript.ntf W32X86/pscript.ntf;put /usr/share/cups/drivers/pscript5.dll W32X86/pscript5.dll'

Domain=[AGIVYP] OS=[Unix] Server=[Samba 3.0.24]

NT_STATUS_OBJECT_NAME_COLLISION making remote directory \W32X86

putting file /var/spool/cups/tmp/4669a0b9b5292 as \W32X86/IS_COP.ppd (11590.7 kb/s) (average 11591.8 kb/s)

putting file /usr/share/cups/drivers/ps5ui.dll as \W32X86/ps5ui.dll (1476.7 kb/s) (average 1593.0 kb/s)

putting file /usr/share/cups/drivers/pscript.hlp as \W32X86/pscript.hlp (1816.3 kb/s) (average 1624.0 kb/s)

putting file /usr/share/cups/drivers/pscript.ntf as \W32X86/pscript.ntf (1954.7 kb/s) (average 1887.5 kb/s)

putting file /usr/share/cups/drivers/pscript5.dll as \W32X86/pscript5.dll (1907.7 kb/s) (average 1894.0 kb/s)

Running command: smbclient //servertest/print$ -N -A /var/spool/cups/tmp/4669a0bc1a9a2 -c 'put /usr/share/cups/drivers/cups6.ini W32X86/cups6.ini;put /usr/share/cups/drivers/cupsps6.dll W32X86/cupsps6.dll;put /usr/share/cups/drivers/cupsui6.dll W32X86/cupsui6.dll'

Domain=[AGIVYP] OS=[Unix] Server=[Samba 3.0.24]

putting file /usr/share/cups/drivers/cups6.ini as \W32X86/cups6.ini (10.9 kb/s) (average 10.9 kb/s)

putting file /usr/share/cups/drivers/cupsps6.dll as \W32X86/cupsps6.dll (1534.2 kb/s) (average 881.3 kb/s)

putting file /usr/share/cups/drivers/cupsui6.dll as \W32X86/cupsui6.dll (1668.9 kb/s) (average 1167.7 kb/s)

Running command: rpcclient servertest -N -A /var/spool/cups/tmp/4669a0bc1a9a2 -c 'adddriver "Windows NT x86" "IS_COP:pscript5.dll:IS_COP.ppd:ps5ui.dll:pscript.hlp:NULL:RAW:pscript5.dll,IS_COP.ppd,ps5ui.dll,pscript.hlp,pscript.ntf,cups6.ini,cupsps6.dll,cupsui6.dll"'

Printer Driver IS_COP successfully installed.

Running command: rpcclient servertest -N -A /var/spool/cups/tmp/4669a0bc1a9a2 -c 'setdriver IS_COP IS_COP'

SetPrinter call failed!

result was WERR_ACCESS_DENIED

```

I have searched high and low on the internet for anyone who has experienced this problem. A lot of people have solutions but they only seem to help half of the people with this problem. HELP!!!   :Shocked: 

----------

## firesox

Hi,

I had the quite same problem a while ago. The very same was, that "cupsaddsmb" wasn't working. I've found some other solution by doing the necessary steps by hand.

The first thing I've found was, that with a samba server running in a mode other than "security = users", e.g. "ads", you have to use a netbios alias in your smb.conf. Then create a new samba configuration based on this alias and add the printer sections in both configs (ads and users). Add a user root with smbpasswd.

Copy the driver of your printer onto the server with this line (where "drucker" is the name of the printer):

```
smbclient //printing/print\$ -U 'root' -c 'mkdir W32X86; cd W32X86; put /etc/cups/ppd/drucker.ppd drucker.ppd; put /usr/share/cups/drivers/PSCRIPT5.DLL pscript5.dll; put /usr/share/cups/drivers/PS5UI.DLL ps5ui.dll; put /usr/share/cups/drivers/PSCRIPT.NTF pscript.ntf; put /usr/share/cups/drivers/PSCRIPT.HLP pscript.hlp'
```

Then add this driver to the printing systems of samba:

```
rpcclient printing -Uroot -c 'adddriver "Windows NT x86" "drucker:pscript5.dll:drucker.ppd:ps5ui.dll:pscript.hlp:NULL:RAW:pscript.ntf"'
```

Then set the driver:

```
rpcclient -Uroot -c 'setdriver drucker drucker' printing
```

Check if all is done right with these commands:

```
rpcclient -Uroot%password -c 'enumprinters' printing

rpcclient -Uroot%password -c 'getprinter drucker' printing

rpcclient -Uroot%password -c 'getdriver drucker' printing
```

Hope this helps.

----------

