How can one set it up so that
su to the same user that is currently logged in, that is
foo$ su -c 'something' foo
does not require a password? This wouldn't add or remove any security, as it should be a noop.
The reason for wanting this is that I would like to have a class of users "below" root that can administer some specific services on the machine that run under that user, e.g.,
mysql (inspect their data, change the configuration, restart, etc.). Those users would get
sudo rights to that account, and that usually works well, except that the init scripts in some cases call
su -c 'start_daemon ...' daemonuser
and that brings down this scheme. Of course, I can change the init scripts or add additional
sudo permissions, but I would like to avoid these sort of exceptions, because they are a mess to maintain in the long run.
The configuration for
su is in PAM, so the right magic possibly lies there.