2

I created a group using the following command:

sudo groupadd myGroup

Then I tried to run gedit and set its primary group to myGroup:

sg myGroup gedit

But sg is asking me for what I assume is the group password.

Does a group created using groupadd have a default password?


Edit:

When I make myGroup part of my user's groups, then sg no longer asks me for the group password. But I do not want to make myGroup part of my user's groups.

  • Did you make sure your user became a member of myGroup. I am not seeing that part in the question. – Tigger Dec 12 '17 at 5:09
  • @Tigger I edited my question. – user7681202 Dec 12 '17 at 5:14
2

No, by default groupadd doesn’t set group passwords (which means they are disabled, and only users who are members of a group can use the group). To set a password, use the -p option to groupadd (but read its documentation first), or better yet, run gpasswd.

  • I did gpasswd myGroup and set a password. And then I did sg myGroup gedit, but sg gave me an "Invalid password." error when I entered the group password. – user7681202 Dec 12 '17 at 7:16
  • Weird, it works for me... – Stephen Kitt Dec 12 '17 at 8:22
  • I'll try it on a fresh install of Linux. – user7681202 Dec 12 '17 at 8:37
  • It worked for me on Ubuntu 9.04 and Ubuntu 16.04, but it didn't work on Ubuntu 10.10! – user7681202 Dec 12 '17 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.