Usermod and history output
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
1
down vote
favorite
I used usermod -G
without the -a
option, now the main user has only 2 groups. I want to restore all the previous groups but the problem is that i need to list all the groups before the changes
I am trying to use
locate /etc/groups
and grep username in the previous version of the file to get all the previous group
How can I access to the file from the db and read them ?
16.04 permissions sudo history
add a comment |Â
up vote
1
down vote
favorite
I used usermod -G
without the -a
option, now the main user has only 2 groups. I want to restore all the previous groups but the problem is that i need to list all the groups before the changes
I am trying to use
locate /etc/groups
and grep username in the previous version of the file to get all the previous group
How can I access to the file from the db and read them ?
16.04 permissions sudo history
Possible duplicate of Default groups for user in Ubuntu?
â muru
May 15 at 15:46
And you'll probably need askubuntu.com/q/70442/158442 as well to get back your lost sudo rights.
â muru
May 15 at 15:46
1
Possible duplicate of How do I add myself back as a sudo user?
â karel
May 15 at 21:03
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I used usermod -G
without the -a
option, now the main user has only 2 groups. I want to restore all the previous groups but the problem is that i need to list all the groups before the changes
I am trying to use
locate /etc/groups
and grep username in the previous version of the file to get all the previous group
How can I access to the file from the db and read them ?
16.04 permissions sudo history
I used usermod -G
without the -a
option, now the main user has only 2 groups. I want to restore all the previous groups but the problem is that i need to list all the groups before the changes
I am trying to use
locate /etc/groups
and grep username in the previous version of the file to get all the previous group
How can I access to the file from the db and read them ?
16.04 permissions sudo history
edited May 15 at 15:52
asked May 15 at 15:14
![](https://i.stack.imgur.com/by876.png?s=32&g=1)
![](https://i.stack.imgur.com/by876.png?s=32&g=1)
eDen
379
379
Possible duplicate of Default groups for user in Ubuntu?
â muru
May 15 at 15:46
And you'll probably need askubuntu.com/q/70442/158442 as well to get back your lost sudo rights.
â muru
May 15 at 15:46
1
Possible duplicate of How do I add myself back as a sudo user?
â karel
May 15 at 21:03
add a comment |Â
Possible duplicate of Default groups for user in Ubuntu?
â muru
May 15 at 15:46
And you'll probably need askubuntu.com/q/70442/158442 as well to get back your lost sudo rights.
â muru
May 15 at 15:46
1
Possible duplicate of How do I add myself back as a sudo user?
â karel
May 15 at 21:03
Possible duplicate of Default groups for user in Ubuntu?
â muru
May 15 at 15:46
Possible duplicate of Default groups for user in Ubuntu?
â muru
May 15 at 15:46
And you'll probably need askubuntu.com/q/70442/158442 as well to get back your lost sudo rights.
â muru
May 15 at 15:46
And you'll probably need askubuntu.com/q/70442/158442 as well to get back your lost sudo rights.
â muru
May 15 at 15:46
1
1
Possible duplicate of How do I add myself back as a sudo user?
â karel
May 15 at 21:03
Possible duplicate of How do I add myself back as a sudo user?
â karel
May 15 at 21:03
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
There is no /etc/groups
. There's /etc/group
and /etc/group-
(the backup). To get results for your user from the backup, you can do:
grep username /etc/group-
Or, to get just the groups, using awk:
awk -F: -v u=username '$NF ~ u print $1' /etc/group-
To then add those groups back, as root:
awk -F: -v u=username '$NF ~ u print $1' /etc/group- |
xargs -n1 gpasswd -a username
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
There is no /etc/groups
. There's /etc/group
and /etc/group-
(the backup). To get results for your user from the backup, you can do:
grep username /etc/group-
Or, to get just the groups, using awk:
awk -F: -v u=username '$NF ~ u print $1' /etc/group-
To then add those groups back, as root:
awk -F: -v u=username '$NF ~ u print $1' /etc/group- |
xargs -n1 gpasswd -a username
add a comment |Â
up vote
1
down vote
accepted
There is no /etc/groups
. There's /etc/group
and /etc/group-
(the backup). To get results for your user from the backup, you can do:
grep username /etc/group-
Or, to get just the groups, using awk:
awk -F: -v u=username '$NF ~ u print $1' /etc/group-
To then add those groups back, as root:
awk -F: -v u=username '$NF ~ u print $1' /etc/group- |
xargs -n1 gpasswd -a username
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
There is no /etc/groups
. There's /etc/group
and /etc/group-
(the backup). To get results for your user from the backup, you can do:
grep username /etc/group-
Or, to get just the groups, using awk:
awk -F: -v u=username '$NF ~ u print $1' /etc/group-
To then add those groups back, as root:
awk -F: -v u=username '$NF ~ u print $1' /etc/group- |
xargs -n1 gpasswd -a username
There is no /etc/groups
. There's /etc/group
and /etc/group-
(the backup). To get results for your user from the backup, you can do:
grep username /etc/group-
Or, to get just the groups, using awk:
awk -F: -v u=username '$NF ~ u print $1' /etc/group-
To then add those groups back, as root:
awk -F: -v u=username '$NF ~ u print $1' /etc/group- |
xargs -n1 gpasswd -a username
answered May 15 at 16:04
muru
129k19271460
129k19271460
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1036577%2fusermod-and-history-output%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Possible duplicate of Default groups for user in Ubuntu?
â muru
May 15 at 15:46
And you'll probably need askubuntu.com/q/70442/158442 as well to get back your lost sudo rights.
â muru
May 15 at 15:46
1
Possible duplicate of How do I add myself back as a sudo user?
â karel
May 15 at 21:03