Printing
Printer management rights
To allow a user to perform management operations (add, remove, …) on a printer, they must be given the corresponding privileges.
This is done as the root user by using the command:
net -U root -n netbiosname rpc rights grant admin SePrintOperatorPrivilege
However, it is not always possible to identify with Samba as
root, because Samba can be configured to use an LDAP
directory in which the root user is missing.
In this case, changes must be made directly to sam instead of going
through an RPC call:
net sam rights grant admin SePrintOperatorPrivilege
Adding a printer
cupsaddsmb did this in one step, for one
printer or for all of them, and it was removed with CUPS 2.x. No command
replaces it as directly. It wrapped
rpcclient’s adddriver and
setdriver, both of which remain — but their driver argument
is a long positional string that varies by driver and by Windows
architecture, so no invocation is printed here rather than one that would
be wrong for most readers.
Uploading the driver from a Windows client’s own Print Management
console does the same job, and is what the [print$] share
described on the Samba page exists
for.
Either way, be careful with the printer name and its case: a difference in case from the name entered in CUPS will result in installation problems on some versions of Windows.
Deleting a printer
rpcclient -U admin printers -c 'deldriver Printer name'
Printing
It is possible, although a direct access to CUPS is generally preferred, to print from Unix using the Samba client. To do this, run the following command:
smbclient -I printers.example.com //printers/queue -c 'print -' < my_file.ps
User account
Lists all the information available for every user
pdbedit -L -v
Lists the users id
net sam list users
Information
Lists the browseable shares:
smbclient -U% -L netbiosname
Lists the resources currently in use and the associated users
smbstatus
Lists all the available privileges
net rpc rights list
Retrieves the SID
net rpc getsid net getlocalsid
Miscellaneous
Shows the file ACLs
This is useful when the zfsacl module is stacked and we want to see
the result of the ACLs created on the Unix file system:
getfacl Filename