R creates a group called staff and I want to be able to update packages without starting R as sudo. So I added myself to staff using:
sudo usermod -G adm,dialout,cdrom,plugdev,lpadmin,admin,sambashare,staff matt
(side question is there a way to add yourself to a group without listing every other group you're a member of?)
If i check /etc/groups i see
staff:x:50:matt
and the same for /etc/shadow
staff:*::matt
however if i run groups or id i'm not a member of staff. Also, I can't make changes to anything in /usr/local/lib/R.
To add an existing user account to a group on your system, use the usermod command, replacing examplegroup with the name of the group you want to add the user to and exampleusername with the name of the user you want to add.
Ubuntu Linux add a user to group command Open the terminal application. Login to Ubuntu server using ssh. Add a new user named foo to www-data group by running useradd -g www-data foo command. Add an existing user bar to Apache's www-data group on Ubuntu using usermod -a -G www-data bar command.
To add a member to a supplementary group, use the usermod command to list the supplementary groups that the user is currently a member of, and the supplementary groups that the user is to become a member of. where user-name is the user name. To display who is a member of a group, use the getent command.
Did you log the "matt" account out and back in after running the sudo usermod
command? Changes to the groups a user is in under unix only take affect at login time.
https://superuser.com/questions/272061/reload-a-linux-users-group-assignments-without-logging-out
check that out ~
both
newgrp groupname
OR
su - username
will do the trick well ~
In answer to your side question, yes you can add a user to a group without listing them all. If you run a Debian based system, you can do it with
sudo adduser matt staff
The adduser
utility is just a friendly wrapper around useradd/usermod etc.
If you don't have the adduser
utility, you can still do it with usermod:
sudo usermod -a -G staff matt
The -a
flag means append (as opposed to overwrite).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With