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?
audiogroup, at least when you don't share your pc with anyone else. I just want my pc to be able to play audio when the screen is locked. And the only way to do so is by adding users to theaudiogroup or start pulseaudio with this group, and that's what I'm doing. I just wonder whether is there a problem when those two files don't match, when you have different group configuration in both of them. The solution has been working for many months without a problem, but recently I discoveredgrpckwhich gave me that message. – Mikhail Morfikov Nov 22 '15 at 14:53sudosupport switching between groups? If so, then this is what you want. – Nov 22 '15 at 15:10