Syndicate content

Adding a group for to a logged in Linux user

Once in a while I want to add my user to a group and then right away make use of that group.

Unfortunately, in general Unix kind of forces you to re-log in for the new group to be attached to your account.

However, a command has been added, a while back, to do just that on the fly. Not something you would want to use in a script, but at least, it works for me when doing a few things here and there.

In my case, I wanted to run QEMU, which I hadn't done in a while, and the system told me that it could not open the KVM, the error: kvm permission denied.

The problem was that I was not part of the KVM group, so I ran the following two commands, tried again and it worked! (that is, that permission denied error was not to be seen again)

usermod -a -G kvm alexis
newgrp kvm

Note that it is important that you use usermod to add the group. If you don't, it probably won't work because the gshadow file needs to be updated too.

To see that the newgrp worked, use either the id or the groups commands.

Source: Unix Stack Exchange

Syndicate content

Diverse Realty

Diverse Realty Team

Want a New Home?
Want to Sell Your House?

Call Alex at
+1 (916)
220 6482

Alexis Wilke, Realtor
Salesperson
Lic. # 02024063

Cory Marcus, Broker
Lic. # 01079165

     

Terms of Site Index

Find the page/content you are looking for with our index.