How to add a new group to user root?
Solution 1
To add a particular user to a particular group use:
sudo usermod -a -G groupname username
Here a
is very important because otherwise the user will be removed from all other groups
Your problem is probably because you missed the -a
part in your command
Solution 2
You can add any user to any group by typing:
sudo gpasswd -a username groupname
Related videos on Youtube
Comments
-
IgorAlves over 1 year
I am running a Ubuntu 16.04 as a guest for a Windows 7 host.
I shared a folder inside Windows and I should be able to see and open the file inside the Linux.
The issue was me, as root, could not open the file because the root is not in the
vboxsf
group.From this post, I just ran this command:
$ usermod -G vboxsf rootusername
After that I have lost the root privileges. I cannot use
sudo su
command, not open root files etc.So how can I add the rootUser to
vboxsf
without losing all admin privileges? -
IgorAlves over 7 yearsYes, that solved the problem (-aG). It is only in a test environment to grab some files from windows.