Quantcast
Channel: Arkaitzj's Blog
Viewing all articles
Browse latest Browse all 10

Linux, add user to a group without logout

$
0
0

We often find that we need to add ourselves to a given group to access a resource.
Like, we need to access the cd reader and only people in the cdrom group can access it. Easy stuff, we just use sudo or su to get permissions and we do adduser my_user cdrom to add ourselves to the cdromgroup.

#adduser my_user cdrom

But this is not end of story. In order to get effective group permissions we need to logout and login again in the system for our group permissions to be refereshed, which is literaly a pain in the ass sometimes.

There is a quick trick that will save our time here, just do:

$newgrp cdrom

If we have been added to the group newgrp will give us instantly group permissions for the given group.
For mor info on the subject:

$man newgrp



Viewing all articles
Browse latest Browse all 10

Trending Articles