Bug 2339189 - xscreensaver-auth: pam_unix(xscreensaver:account): setuid failed: Operace není povolena
Summary: xscreensaver-auth: pam_unix(xscreensaver:account): setuid failed: Operace nen...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: xscreensaver
Version: 43
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Mamoru TASAKA
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-01-21 19:20 UTC by Jaroslav Škarvada
Modified: 2026-11-10 17:50 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-12-16 18:28:19 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jaroslav Škarvada 2025-01-21 19:20:47 UTC
After some recent update the following error started to periodically show in the syslog:
Jan 21 19:59:04 localhost xscreensaver-auth[32844]: pam_unix(xscreensaver:account): setuid failed: Operace není povolena

"Operace neni povolena" is error message in my locale, in english it means "Operation not permitted".


Reproducible: Always

Steps to Reproduce:
1. Lock screen
2. Unlock screen
3.
Actual Results:  
The following error in the syslog:
Jan 21 19:59:04 localhost xscreensaver-auth[32844]: pam_unix(xscreensaver:account): setuid failed: Operace není povolena

Expected Results:  
No error

pam-1.6.1-7.fc41.x86_64
xscreensaver-6.09-3.fc41.x86_64

$ rpm -qV xscreensaver
EMPTY

$ rpm -qV pam
..?......  c /etc/security/opasswd
..?......    /usr/sbin/unix_update
..?......  c /etc/security/opasswd
IMHO this is for password change, so it should be unrelated to the error.

Reproduced in the Xfce desktop.

Comment 1 Jaroslav Škarvada 2025-01-21 20:30:45 UTC
It maybe pam, it seems it started to show this message after upgrade to f41.

There is nothing in the xscreensaver verbose log, it authorizes OK then the message appears in the log on each unlock.

Comment 2 Jaroslav Škarvada 2025-01-21 20:31:54 UTC
I.e. according to the time stamps it seems the message appears when the PAM communication is initiated (or in progress).

Comment 3 Mamoru TASAKA 2025-01-22 08:13:07 UTC
Once asking pam maintainer for help

/etc/pam.d/xscreensaver contains

------------------------------------------
#%PAM-1.0

# Fedora Core 5:
auth       include	system-auth

# SuSE 9.0: (along with "configure --with-passwd-helper" and "unix2_chkpwd")
# auth     required       pam_unix2.so	nullok

# Distant past:
# auth       required	/lib/security/pam_pwdb.so shadow nullok

# Account validation
account include system-auth
--------------------------------------------

Comment 4 Mamoru TASAKA 2025-01-22 12:25:35 UTC
I maybe wrong, but looks like pam seems to be saying that this is okay:

https://github.com/linux-pam/linux-pam/blob/9438e084e2b318bf91c3912c0b8ff056e1835486/modules/pam_unix/pam_unix_acct.c#L113-L117

Maybe pam did not change the behavior recently, but syslog (systemd?) changed the behavoir recently
which now really logs the output to the file?

Comment 5 Jaroslav Škarvada 2025-01-23 11:07:52 UTC
I see the messages in the systemd journal, e.g. "journalctl -b". I am also running rsyslogd on top of it, so I see this messages in the /var/log/secure, i.e. it passes through the default filter:authpriv.*. I verified the priority of this message is debug. It wasn't logged in f40 or lower. I can customize the default rsyslog filters to ignore debug priority and run journalctl with the -p option to filter out the debug priority, but is it worth to log it? For me the message seems useless and confusing.

Comment 6 Iker Pedrosa 2025-01-23 14:19:33 UTC
PAM's behaviour regarding shadow file reading has changed a bit in recent versions. In old versions, there were a set of system calls that were tried before invoking the 'unix_chkpwd' helper binary, and probably they were enough for they were doing. In recent versions though, the helper binary is always called, and that means that pam_unix needs to be able to change the effective ID before its execution. This will allow the helper binary to check the shadow file.

Can you provide additional information? Is this message triggered when locking or when unlocking the screen? Can you share the PAM service file for xscreensaver?

Comment 7 Jaroslav Škarvada 2025-01-23 14:29:05 UTC
(In reply to Iker Pedrosa from comment #6)
> PAM's behaviour regarding shadow file reading has changed a bit in recent
> versions. In old versions, there were a set of system calls that were tried
> before invoking the 'unix_chkpwd' helper binary, and probably they were
> enough for they were doing. In recent versions though, the helper binary is
> always called, and that means that pam_unix needs to be able to change the
> effective ID before its execution. This will allow the helper binary to
> check the shadow file.
> 
> Can you provide additional information? Is this message triggered when
> locking or when unlocking the screen? Can you share the PAM service file for
> xscreensaver?

It happens only when unlocking. My pam is the same as shared in comment 3.

Btw I also found similar report on xsecurelock (https://github.com/google/xsecurelock/issues/186). I haven't tested xsecurelock in Fedora, but probably xscreensaver is not the only tool affected.

Comment 8 Iker Pedrosa 2025-02-10 11:55:19 UTC
Ok, this could be a misconfiguration problem of either xscreensaver or SELinux. Under which user is xscreensaver running? Note that this user should be able to change the UID to root in order to run the account validity checks from pam_unix.

Is SELinux enabled? If so, do you see any problems in your logs related to a UID change by xscreensaver or pam_unix?

Comment 9 Jaroslav Škarvada 2025-03-10 14:53:05 UTC
(In reply to Iker Pedrosa from comment #8)
> Ok, this could be a misconfiguration problem of either xscreensaver or
> SELinux. Under which user is xscreensaver running? 
Normal user.

$ id
uid=1000(yarda) gid=1000(yarda) groups=1000(yarda),5(tty),6(disk),10(wheel),11(cdrom),18(dialout),19(floppy),20(games),30(tape),39(video),54(lock),63(audio),100(users),135(mock),977(input),980(wireshark),981(pkg-build),983(usrp),984(vboxusers),993(openvpn),995(brlapi),1001(logs),1002(rtlsdr),1003(sbox) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

> Note that this user
> should be able to change the UID to root in order to run the account
> validity checks from pam_unix.

How? With sudo? It's normal (mostly normal, not counting the wheel group) desktop user.

> Is SELinux enabled?
Yes.

> If so, do you see any problems in your logs related to a
> UID change by xscreensaver or pam_unix?
No AVC in the logs.

Comment 10 Iker Pedrosa 2025-03-11 08:15:41 UTC
(In reply to Jaroslav Škarvada from comment #9)
> (In reply to Iker Pedrosa from comment #8)
> > Ok, this could be a misconfiguration problem of either xscreensaver or
> > SELinux. Under which user is xscreensaver running? 
> Normal user.
> 
> $ id
> uid=1000(yarda) gid=1000(yarda)
> groups=1000(yarda),5(tty),6(disk),10(wheel),11(cdrom),18(dialout),19(floppy),
> 20(games),30(tape),39(video),54(lock),63(audio),100(users),135(mock),
> 977(input),980(wireshark),981(pkg-build),983(usrp),984(vboxusers),
> 993(openvpn),995(brlapi),1001(logs),1002(rtlsdr),1003(sbox)
> context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

That's your user, not the user xscreensaver is running under.

This is quite complex to check, but it would involve some type of terminal access to run top (or some other system information application) while xscreensaver is running.

> > Note that this user
> > should be able to change the UID to root in order to run the account
> > validity checks from pam_unix.
> 
> How? With sudo? It's normal (mostly normal, not counting the wheel group)
> desktop user.
> 
> > Is SELinux enabled?
> Yes.
> 
> > If so, do you see any problems in your logs related to a
> > UID change by xscreensaver or pam_unix?
> No AVC in the logs.

Thanks! That's what I was looking for. I'm changing the component to xscreensaver as I suspect the application isn't running under a user that has permissions to check /etc/passwd (and related) files.

Comment 11 Jaroslav Škarvada 2025-03-12 15:44:26 UTC
(In reply to Iker Pedrosa from comment #10)
> (In reply to Jaroslav Škarvada from comment #9)
> > (In reply to Iker Pedrosa from comment #8)
> > > Ok, this could be a misconfiguration problem of either xscreensaver or
> > > SELinux. Under which user is xscreensaver running? 
> > Normal user.
> > 
> > $ id
> > uid=1000(yarda) gid=1000(yarda)
> > groups=1000(yarda),5(tty),6(disk),10(wheel),11(cdrom),18(dialout),19(floppy),
> > 20(games),30(tape),39(video),54(lock),63(audio),100(users),135(mock),
> > 977(input),980(wireshark),981(pkg-build),983(usrp),984(vboxusers),
> > 993(openvpn),995(brlapi),1001(logs),1002(rtlsdr),1003(sbox)
> > context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
> 
> That's your user, not the user xscreensaver is running under.
> 
> This is quite complex to check, but it would involve some type of terminal
> access to run top (or some other system information application) while
> xscreensaver is running.
> 
$ ps -ef | grep xscreensaver
yarda       2328    2018  0 13:46 ?        00:00:07 xscreensaver -nosplash
yarda       2338    2328  0 13:46 ?        00:00:00 xscreensaver-systemd

I will check through the ssh when the screensaver is running.

Comment 12 rallenh 2025-04-16 23:06:10 UTC
Hi,

Sorry if I'm butting in....

XScreensaver uses xscreensaver-auth to handle the password prompts. The binary is "/usr/libexec/xscreensaver/xscreensaver-auth" and it should be installed setuid root:

❯ stat -c "%a %U:%G %n" /usr/libexec/xscreensaver/xscreensaver-auth
4755 root:root /usr/libexec/xscreensaver/xscreensaver-auth

The xscreensaver daemon/user systemd (the pids you found) then exec's it for the end-user. Jamie use to have a FAQ for this but it seems its been removed.

You also need a PAM configuration for xscreensaver (which is in the FAQ still) and covered in the man page in the section "PAM PASSWORDS":
https://www.jwz.org/xscreensaver/man1.html

Comment 13 Jaroslav Škarvada 2025-04-22 12:42:00 UTC
$ rpm -qV xscreensaver-base
EMPTY

$ stat -c "%a %U:%G %n" /usr/libexec/xscreensaver/xscreensaver-auth
755 root:root /usr/libexec/xscreensaver/xscreensaver-auth

$ rpm -ql xscreensaver-base | grep pam
/etc/pam.d/xscreensaver

$ cat /etc/pam.d/xscreensaver
#%PAM-1.0

# Fedora Core 5:
auth       include	system-auth

# SuSE 9.0: (along with "configure --with-passwd-helper" and "unix2_chkpwd")
# auth     required       pam_unix2.so	nullok

# Distant past:
# auth       required	/lib/security/pam_pwdb.so shadow nullok

# Account validation
account include system-auth

I will try SUID xscreensaver-auth, but it isn't SUID in the RPM.

Comment 14 rallenh 2025-04-23 03:10:02 UTC
Odd, indeed.

❯ sudo rpm --quiet -V xscreensaver-base; echo $?
0

❯ rpm -qlv xscreensaver-base | grep xscreensaver-auth
lrwxrwxrwx    1 root     root                       54 Apr 13 20:00 /usr/lib/.build-id/72/73a748fb49c90c7adf8aa42ec5920b01aedad2 -> ../../../../usr/libexec/xscreensaver/xscreensaver-auth
-rwsr-xr-x    1 root     root                   285784 Apr 13 20:00 /usr/libexec/xscreensaver/xscreensaver-auth
-rw-r--r--    1 root     root                      586 Apr 13 20:00 /usr/share/man/man6/xscreensaver-auth.6.gz

There it is, setuid perms in the installed package. Then I remembered, I re-build xscreensaver myself to get a patch in for DPMS (panel sleep/standby/off) to activate. DPMS hasn't been activating for me since Fedora 38/39 time frame. I did create a ticket for this (with a patch). I can also confirm that with /usr/libexec/xscreensaver/xscreensaver-auth setuid, unlocking via my local password (no sssd, a/d, nis, etc) works as expected. I guess no one uses xscreensaver w/locking these days?

I rebuilt the Koji srpm to verify:
❯ sudo mock -r fedora-41-x86_64 --scrub=all
❯ sudo mock -r fedora-41-x86_64 --rebuild ~/rpmbuild/SRPMS/xscreensaver-6.09-3.fc41.src.rpm

Which does install /usr/libexec/xscreensaver/xscreensaver-auth setuid in the buildroot:
❯ cat /var/lib/mock/fedora-41-x86_64/result/build.log | grep xscreensaver-auth
install -c -p -o root -m 4755 xscreensaver-auth /builddir/build/BUILD/xscreensaver-6.09-build/BUILDROOT/usr/libexec/xscreensaver/xscreensaver-auth

This doesn't happen in koji builds and xscreensaver source does in fact emit WARNINGs. Koji build log https://kojipkgs.fedoraproject.org//packages/xscreensaver/6.09/3.fc41/data/logs/x86_64/build.log:
install -c -p -o root -m 4755 xscreensaver-auth /builddir/build/BUILD/xscreensaver-6.09-build/BUILDROOT/usr/libexec/xscreensaver/xscreensaver-auth
install: cannot change ownership of '/builddir/build/BUILD/xscreensaver-6.09-build/BUILDROOT/usr/libexec/xscreensaver/xscreensaver-auth': Operation not permitted
install -c -p xscreensaver-auth /builddir/build/BUILD/xscreensaver-6.09-build/BUILDROOT/usr/libexec/xscreensaver/xscreensaver-auth
WARNING: unable to install xscreensaver-auth setuid.
WARNING: authentication may not work!

Comment 15 rallenh 2025-04-23 04:05:28 UTC
Perhaps a post_inst script during install to check/confirm /usr/libexec/xscreensaver/xscreensaver-auth is setuid is now needed?

Comment 16 Jaroslav Škarvada 2025-04-23 08:51:04 UTC
I think you need to use "%attr(4755, root, root)" in the SPEC. But generally fedora is moving to capabilities where possible.

Comment 17 Jaroslav Škarvada 2025-04-23 08:54:31 UTC
But it doesn't seem to change anything for me:
Apr 23 10:52:44 localhost xscreensaver-auth[42485]: pam_unix(xscreensaver:account): setuid failed: Operation not permitted

$ stat -c "%a %U:%G %n" /usr/libexec/xscreensaver/xscreensaver-auth
4755 root:root /usr/libexec/xscreensaver/xscreensaver-auth

Comment 18 Jaroslav Škarvada 2025-04-23 09:00:05 UTC
> I can also confirm that with /usr/libexec/xscreensaver/xscreensaver-auth setuid, unlocking via my local password (no sssd, a/d, nis, etc) works as expected. I guess no one uses xscreensaver w/locking these days?

For me it worked all the time w/wo the SUID, no problem. I am using local password with PAM. The only discomfort is that I see the useless and confusing debug message "setuid failed" in the logs each time I unlock the desktop.

Comment 19 Jaroslav Škarvada 2025-04-23 09:02:35 UTC
(In reply to Jaroslav Škarvada from comment #18)
> > I can also confirm that with /usr/libexec/xscreensaver/xscreensaver-auth setuid, unlocking via my local password (no sssd, a/d, nis, etc) works as expected. I guess no one uses xscreensaver w/locking these days?
> 
> For me it worked all the time w/wo the SUID, no problem. I am using local
> password with PAM. The only discomfort is that I see the useless and
> confusing debug message "setuid failed" in the logs each time I unlock the
> desktop.

And xscreensaver-systemd is running on my machine.

Comment 20 rallenh 2025-04-28 04:24:59 UTC
I really messed this (and you) up.

I thought this related to "longtime" xscreensaver issue:
allen@fedora:~$ xscreensaver
xscreensaver-auth: 23:07:00.53: OOM: /proc/3555/oom_score_adj: Permission denied
xscreensaver-auth: 23:07:00.53:   To prevent the kernel from randomly unlocking
xscreensaver-auth: 23:07:00.53:   your screen via the out-of-memory killer,
xscreensaver-auth: 23:07:00.53:   "xscreensaver-auth" must be setuid root.
xscreensaver: 23:22:21.98: SIGINT received: exiting

But it isn't and I completely missed that. I grabbed FC42 and did a fresh install. Disabled all the GNOME lock/blank settings and switched to XOrg; then I saw the issue:
Apr 25 00:31:12 fedora xscreensaver-auth[4726]: pam_unix(xscreensaver:account): setuid failed: Operation not permitted

So this message appeared in FC40 when pam was upgraded from 1.6.0 to 1.6.1. pam_unix.so has gotten alot of attention of late but the change that made this message appear is from a fix for OpenVPN:

https://github.com/linux-pam/linux-pam/commit/b7b96362087414e52524d3d9d9b3faa21e1db620
https://github.com/linux-pam/linux-pam/issues/747

The short story is there was geteuid == 0 check that happened prior to setuid(0). That was removed and hence, the message. Now, pam_unix.so will always try to setuid(0) no matter the circumstances. This is also discussed here:
https://github.com/linux-pam/linux-pam/commit/b3020da7da384d769f27a8713257fbe1001878be

I also think this is innocuous message, xscreensaver-auth still reports success:
xscreensaver: 21:12:16.93: authorizing
xscreensaver: 21:12:16.93: pid 565468: launched xscreensaver-auth --verbose --verbose --verbose
xscreensaver-auth: 21:12:16.94: pwnam: couldn't get password of "allen"
xscreensaver-auth: 21:12:16.94: initial effective uid/gid was root/users (0/100)
xscreensaver-auth: 21:12:16.94: changed uid/gid to allen/users (1001/100)
xscreensaver-auth: 21:12:16.94: running as user "allen"
xscreensaver-auth: 21:12:16.94: PAM: pam_start ("xscreensaver", "allen", ...) ==> 0 (Success)
xscreensaver-auth: 21:12:16.94:   pam_set_item (p, PAM_TTY, ":1") ==> 0 (Success)
xscreensaver-auth: 21:12:16.94:   pam_authenticate (...) ...
xscreensaver-auth: 21:12:16.94:     pam_conversation (ECHO_OFF="Password: ") ...
xscreensaver-auth: 21:12:16.95: mouse is at 1238,218 on monitor 5 3840x2160+0+0 "DP-4"
xscreensaver-auth: 21:12:16.95: theme: default
xscreensaver-auth: 21:12:16.99: kbd layout: English (US)
xscreensaver-auth: 21:12:16.99: re-creating window: size changed
xscreensaver-auth: 21:12:17.00: FPS: 0.0
xscreensaver-auth: 21:12:17.00: VisibilityNotify
xscreensaver-auth: 21:12:17.00: FPS: 1.0
xscreensaver-auth: 21:12:17.06: XI RawKeyRelease
xscreensaver-auth: 21:12:17.91: XI RawKeyPress  
xscreensaver-auth: 21:12:18.01: XI RawKeyRelease
xscreensaver-auth: 21:12:18.01: FPS: 30.0
xscreensaver-auth: 21:12:18.18: XI RawKeyPress  
xscreensaver-auth: 21:12:18.24: XI RawKeyRelease
xscreensaver-auth: 21:12:18.31: XI RawKeyPress  
xscreensaver-auth: 21:12:18.41: XI RawKeyRelease
xscreensaver-auth: 21:12:18.51: XI RawKeyPress  
xscreensaver-auth: 21:12:18.61: XI RawKeyRelease
xscreensaver-auth: 21:12:18.68: XI RawKeyPress  
xscreensaver-auth: 21:12:18.78: XI RawKeyRelease
xscreensaver-auth: 21:12:18.85: XI RawKeyPress  
xscreensaver-auth: 21:12:18.95: XI RawKeyRelease
xscreensaver-auth: 21:12:19.02: XI RawKeyPress  
xscreensaver-auth: 21:12:19.02: XKB event 2
xscreensaver-auth: 21:12:19.03: kbd layout: English (US)
xscreensaver-auth: 21:12:19.03: FPS: 30.0
xscreensaver-auth: 21:12:19.06: XI RawKeyPress  
xscreensaver-auth: 21:12:19.13: XI RawKeyRelease
xscreensaver-auth: 21:12:19.13: XKB event 2
xscreensaver-auth: 21:12:19.13: kbd layout: English (US)
xscreensaver-auth: 21:12:19.17: XI RawKeyPress  
xscreensaver-auth: 21:12:19.17: authentication input finished
xscreensaver-auth: 21:12:19.17:     pam_conversation (...) ==> PAM_SUCCESS
xscreensaver-auth: 21:12:19.17:   pam_authenticate (...) ==> 0 (Success)
xscreensaver-auth: 21:12:19.18:   pam_acct_mgmt (...) ==> 0 (Success)
xscreensaver-auth: 21:12:19.18:   pam_setcred (...) ==> 0 (Success)
xscreensaver-auth: 21:12:19.18: pam_end (...) ==> 0 (Success)
xscreensaver-auth: 21:12:19.18: deleted auth failure property
xscreensaver-auth: 21:12:19.18: authentication succeeded
xscreensaver: 21:12:19.18: pid 565468: xscreensaver-auth exited and authenticated

I don't know if the xscreensaver pam stack should be changed. I guess it doesn't b/c it does work, there's just an added message about setuid(0) now. I guess you can add your own pam stack setup such that the message goes away by not using pam_unix.so for the account module.

I guess systemd-logind doesn't permit setuid(0)? Or maybe the mounts are nosuid? I don't know how to debug/research what's going on in systemd-logind.

Again, sorry for the noise and misdrection.

Comment 21 Adam Williamson (Red Hat non-Fedora) 2025-12-02 02:12:03 UTC
This message is a reminder that Fedora Linux 41 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 41 on 2025-12-15.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '41'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 41 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 22 Samyak Jain (RedHat) 2025-12-16 18:28:19 UTC
Fedora Linux 41 entered end-of-life (EOL) status on 2025-12-15.

Fedora Linux 41 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 23 Aoife Moloney 2026-11-10 17:50:21 UTC
This message is a reminder that Fedora Linux 43 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 43 on 2026-12-02.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '43'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 43 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.


Note You need to log in before you can comment on or make changes to this bug.