3 # Copyright (C) 2011 W. Trevor King <wking@drexel.edu>
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Lesser General Public License as
7 # published by the Free Software Foundation, either version 3 of the
8 # License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this program. If not, see
17 # <http://www.gnu.org/licenses/>.
21 # Uses root permissions to assume `nobody` credentials from a central
22 # keytab, and then transfers ownership of the resulting ticket to the
25 ROOT_UID=$(id --user root)
26 MPD_UID=$(id --user mpd)
27 NOBODY_KEYTAB=/etc/krb5.nobody.keytab
30 sudo kinit -k -t "${NOBODY_KEYTAB}" "${NOBODY_USER}"
31 sudo mv "/tmp/krb5cc_${ROOT_UID}" "/tmp/krb5cc_${MPD_UID}"
32 sudo chown mpd.audio "/tmp/krb5cc_${MPD_UID}"