Showing the Windows user when printing to CUPS on Linux
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Showing the Windows user when printing to CUPS on Linux
I have a Fedora server running SAMBA and CUPS and can successfully print my jobs from various Windows machines to the Linux box.
I display a custom banner page showing various bits of information, including the username of the person originating the job.
What I want to know is; is there any way to display the Windows user on the banner, WITHOUT having to join the Linux machine to the various Windows domains?
I don't need to authenticate the users or anything like that, simply showing the username would be sufficient.
All the banner shows for the Windows users is 'root'.
the files that are being printed - are they local files to the windows machine or files accessed from this server via Samba. If the latter, is the user required to authenticate when trying to access a directory on the Linux box?
There are both local and remote files being printed. The local files show the username correctly as the local account that has printed them. However, the remote files just show the user as root.
The remote files are being printed from a Windows XP box to the printer, added as a 'new network printer' on the XP box by simply browsing to the Linux server from the 'Add a new printer wizard'. I have set up Samba to use cups as the printing system so all the printers configured on the Linux box are visible to other machines.
The Windows machines can all print to the box quite happily at the moment, with no authentication specified in the /etc/cups/cups.conf file.
I'm not sure how I would set up the authentication as there are a number of Windows machines on different domains, some on workgroups that all need to print to this Linux server.
I was hoping that I could just leave the printing as unauthenticated, therefore allowing everyone to print, but just log who was printing what. I can obtain the IP address of the machine printing. I just expected that the username would be available somehow as well.
Are the remote files located on a Linux box running Samba? If so, would you post your smb.conf file (snipping any confidential info)? I'm curious to see what your "server" line is (eg. security = share). On my remote files located on Linux running Samba, users have to authenticate when trying to access any of the files. This would not be the case if smb.conf has security = share, so it may access those files as root. This isn't my knowledge, just my thought. With the information you have provided as well as a look at the smb.conf file, someone on this forum should be able to provide assistance.
The Fedora box is running Samba and cups.
There are a number of printers configured and shared out on this box.
There are also some file shares.
Windows users on XP machines can access the shares (with a suitable username and password) and can print to the shared printers without any authentication.
This is all working fine, as I want it. The only thing I need is to be able to determine the identity of the Windows users when they print their files.
If a Linux user logged on to the box prints a file then the banner I have configured correctly shows their username. If a Windows user remotely prints a file to one of the shared printers then their username is shown as 'root'.
I haven't got access to the box today to be able to post up the smb.conf but I know that the security is set to user.
I strongly suspect that the only way to do this is going to be to join the Linux box to the Windows domain in order to enumerate the Windows users.
I really didn't want to do this though and was hoping that perhaps somewhere in the print job or in the IPP communication from the Windows clients to the Linux server that the username might be held somewhere that I could pick up and display, without having to authenticate against it.
I don't think you would have to join the Linux box to the domain, but I would think the user, when on his/her Windows box would have to authenticate to the Linux box when accessing a share on that Linux box (provided security = user), unless permission is set for everyone to access the share. I'll try to do some testing when I get to my Linux boxes.
Had problems getting back to you as I kept getting server error when trying to get onto linuxquestions.org. Anyway, when I set security to user in smb.conf, and I try to access a Linux share from my Windows box, I'm prompted for credentials. Were you able to find anything else on yours?
I'm not talking about Windows users accessing shares; that works fine and they get prompted for a username/ password.
I'm talking about printing... Windows users printing to a Linux box runnning cups.
Once a Windows user has installed the printer (by browsing to the Linux box and selecting the printer. I.e. in the 'Add a new printer' wizard they add a new network printer and then browse to the linux box with \\LinuxBox\ and all the printers are displayed and automatically installed once one is chosen as I have installed the Windows drivers on the Linux box), then they can just print to that printer like any other printer. There is no browsing to a share, no further authentication is required.
I just want to know the domain/username of the Windows user that submitted the job.
Just to re-iterate, this is not Windows users trying to log on to the Linux server, or browse a share, or anything like that. They are simply submitting print jobs to a printer that happens to be accessed via the Linux box.
My mistake. I was in the mindset that the print job pulled user info from the file being printed. Maybe someone can come up with an answer quicker, but I'll keep looking into it because I'd like to know the resolution also. I'll keep you posted on my progress.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.