In linux, there's two files where group definitions are specified. One of them is /etc/group and the other is /etc/gshadow. I want my regular user to be able to switch a group while starting a process without typing any passwords. It's important that the user shouldn't be a member of that group.
I've managed to do so by setting these two files in the following way:
# cat /etc/group | grep audio
audio:x:29:pulse
# cat /etc/gshadow | grep audio
audio:*::pulse,morfik
And now the user morfik is able to run, for instance, this command:
$ /usr/bin/sg audio -c "pulseaudio -D"
$ ps -eo user,group,args | grep pulse
morfik audio pulseaudio -D
morfik audio /usr/lib/pulseaudio/pulse/gconf-helper
But there's a problem with grpck, which gives the following output:
# grpck
'morfik' is a member of the 'audio' group in /etc/gshadow but not in /etc/group
If I removed the user from the audio group from the /etc/gshadow file, and then tried to start the process, I would get the following error:
sg[2378]: Failed to crypt password with previous salt of group 'audio'
So the question really is: should I be worried about grpck's message? Maybe is there a way to fix the sg's error so everybody would be happy?