You are not logged in.

#1 2019-07-08 15:29:27

tkit
Member
Registered: 2017-02-25
Posts: 15

[Solved][User groups]gnome-terminal and `groups`

When I open gnome-terminal, I find that my user only belong to one group. However it belongs to 3 groups as the command "cat /etc/group" shows. I have to run "su ${user}" to gain the proliviege of the rest groups. e.g. I cant run docker commands if I don't run "su ${user}".
In gnome-terminal:

➜  ~ whoami 
tkit
➜  ~ cat /etc/group | grep tkit 
wheel:x:998:tkit
rtkit:x:133:
docker:x:973:tkit
➜  ~ groups
root
➜  ~ su tkit
密码:
➜  ~ groups
root docker wheel
➜  ~ gnome-terminal --version
# GNOME Terminal 3.32.2 using VTE 0.56.3 +GNUTLS

In xterm all the groups are shown properly without runing "su ${user}".

I've seen a similar problem in stackoverflow https://superuser.com/questions/1348196 … -one-group, but he seems to using kde, and when he switch to gdm his problem disappers.

I am using gdm by default

➜  ~ pacman -Q gnome-terminal gdm
gnome-terminal 3.32.2-1
gdm-plymouth 3.32.0+2+g820f90f5-1

How can I get gnome-terminal to work properly? Can anyone kind tell me?

Last edited by tkit (2019-07-09 09:53:07)

Offline

#2 2019-07-08 21:58:17

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,499

Re: [Solved][User groups]gnome-terminal and `groups`

id -u
id -ru
id -G
id -rG
type id
type groups

Offline

#3 2019-07-08 23:33:06

tkit
Member
Registered: 2017-02-25
Posts: 15

Re: [Solved][User groups]gnome-terminal and `groups`

➜  ~ id -u
1000
➜  ~ id -ru
1000
➜  ~ id -G
0 973 998
➜  ~ id -rG
0 973 998
➜  ~ type id
id is /usr/bin/id
➜  ~ type groups
groups is /usr/bin/groups
➜  ~ su tkit
密码:
➜  ~ id -u
1000
➜  ~ id -ru
1000
➜  ~ id -G
0 973 998
➜  ~ id -rG
0 973 998
➜  ~ type id
id is /usr/bin/id
➜  ~ type groups
groups is /usr/bin/groups

Offline

#4 2019-07-08 23:42:38

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [Solved][User groups]gnome-terminal and `groups`

How did you install Arch?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2019-07-08 23:50:17

tkit
Member
Registered: 2017-02-25
Posts: 15

Re: [Solved][User groups]gnome-terminal and `groups`

jasonwryan wrote:

How did you install Arch?

I followed the instruction on the wiki page. That's about 1 or 2 years ago, i cannot remember it exactly. Untill recently, I need to use docker and I found the question about groups.

I tried other terminals, xterm Deepin, Terminal  and QTerminal  work fine but Tilix works the same as gnome-terminal.

The work around is to use other terminal or run su ${user}, before running docker command to gain the privilege.

Offline

#6 2019-07-09 03:21:03

tkit
Member
Registered: 2017-02-25
Posts: 15

Re: [Solved][User groups]gnome-terminal and `groups`

I added a new account and login to it and the the new account works properly. So i deleted my old account , add a new account with the same username and change the ownership of the old home directory. Gnome terminal works properly now. I dont know why this happens.

Offline

#7 2019-07-09 06:33:24

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,499

Re: [Solved][User groups]gnome-terminal and `groups`

Why was your old user part of the root group and is your new user as well? Is it in the users group?

useradd --defaults

https://wiki.archlinux.org/index.php/Us … Group_list

Why the "/usr/bin/groups" results would differ from the "/usr/bin/id" ones **and only in certain VTEs** (seems vte3) is beyond me (doesn't seem to be a shell/alias issue since "type" is clean), but I'd expect the group list to differ?

Offline

#8 2019-07-09 06:57:07

tkit
Member
Registered: 2017-02-25
Posts: 15

Re: [Solved][User groups]gnome-terminal and `groups`

Anser to your question:
1. I add it to the root group mannually.
2. My new user is in the root group too.
3. Neither of them are in the user group

The default option for useradd:

➜  ~ useradd -D
密码:
GROUP=985
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no

This this the information about my new user.

➜  ~ id -u
1002
➜  ~ id -ru
1002
➜  ~ id -G
1002 0 973 998
➜  ~ id -rG
1002 0 973 998
➜  ~ type id
id is /usr/bin/id
➜  ~ type groups
groups is /usr/bin/groups
➜  ~ groups
root docker wheel tkit

and this is the command i used

userdel tkit
user add -m tkit
gpasswd -a tkit docker
gpasswd -a tkit root
gpasswd -a tkit wheel
chown -R tkit:tkit /home/tkit 

There was a warning about the home directory because it already exits. After changing the owner, the new account works properly. I changed my shell to zsh using chsh later. Both the new and the old account uses zsh.

It seems that useradd will not add a new accout to the user group by default. If i do not add a new user to the user group, what will happen? The wiki says it is Standard users group, but I haven't seen any influence.

Offline

#9 2019-07-09 07:29:24

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,499

Re: [Solved][User groups]gnome-terminal and `groups`

GROUP=985
grep 985 /etc/group
grep users /etc/group

Being in the users group will allow you access to several system files which are not world readable/executable ("640") - you typically want your user to be in that group.
Otoh, i'd be very reluctant to add myself to the root group - wheel should entirely suffice.

The useradd behavior is defined by /etc/login.defs and  /etc/default/useradd

pacman -Qo /etc/login.defs  /etc/default/useradd
pacman -Qikk shadow # since shadow is supposed to provide both files

Still doesn't explain the wacko vte3 behavior - difference right now is that you've a user group and are added to it.

Offline

#10 2019-07-09 07:45:37

tkit
Member
Registered: 2017-02-25
Posts: 15

Re: [Solved][User groups]gnome-terminal and `groups`

➜  ~ grep 985 /etc/group

users:x:985:
➜  ~ grep users /etc/group

users:x:985:
vboxusers:x:108:
➜  ~ LANG=en_US.UTF-8 
➜  ~ pacman -Qo /etc/login.defs  /etc/default/useradd 

/etc/login.defs is owned by shadow 4.6-3
/etc/default/useradd is owned by shadow 4.6-3

➜  ~ pacman -Qikk shadow # since shadow is supposed to provide both files

Name            : shadow
Version         : 4.6-3
Description     : Password and account management tool suite with support for
                  shadow files and PAM
Architecture    : x86_64
URL             : https://github.com/shadow-maint/shadow
Licenses        : BSD
Groups          : base
Provides        : None
Depends On      : bash  pam  acl  audit  libaudit.so=1-64
Optional Deps   : None
Required By     : git  redis  util-linux
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 4.30 MiB
Packager        : Levente Polyak <anthraxx@archlinux.org>
Build Date      : 2019年04月04日 星期四 04时33分12秒
Install Date    : 2019年05月24日 星期五 10时02分55秒
Install Reason  : Explicitly installed
Install Script  : Yes
Validated By    : Signature

shadow: 558 total files, 0 altered files
➜  ~ 

It seems the 985 is the id of the group for users, but my account is not in the group

➜  ~ cat /etc/default/useradd 
# useradd defaults file for ArchLinux
# original changes by TomK
GROUP=users
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no

➜  ~ cat /etc/login.defs | grep "^[^#]" 
FAIL_DELAY		3
LOG_UNKFAIL_ENAB	no
LOG_OK_LOGINS		no
SYSLOG_SU_ENAB		yes
SYSLOG_SG_ENAB		yes
CONSOLE		/etc/securetty
SU_NAME		su
MAIL_DIR	/var/spool/mail
HUSHLOGIN_FILE	.hushlogin
ENV_SUPATH	PATH=/usr/local/sbin:/usr/local/bin:/usr/bin
ENV_PATH	PATH=/usr/local/sbin:/usr/local/bin:/usr/bin
TTYGROUP	tty
TTYPERM		0600
ERASECHAR	0177
KILLCHAR	025
UMASK		077
PASS_MAX_DAYS	99999
PASS_MIN_DAYS	0
PASS_WARN_AGE	7
UID_MIN			 1000
UID_MAX			60000
SYS_UID_MIN		  500
SYS_UID_MAX		  999
GID_MIN			 1000
GID_MAX			60000
SYS_GID_MIN		  500
SYS_GID_MAX		  999
LOGIN_RETRIES		5
LOGIN_TIMEOUT		60
CHFN_RESTRICT		rwh
DEFAULT_HOME	yes
USERGROUPS_ENAB yes
MOTD_FILE
ENCRYPT_METHOD	SHA512
➜  ~ type useradd
useradd is /usr/bin/useradd

Last edited by tkit (2019-07-09 08:01:20)

Offline

#11 2019-07-09 09:46:38

tkit
Member
Registered: 2017-02-25
Posts: 15

Re: [Solved][User groups]gnome-terminal and `groups`

I found the cause.
The main group of the user was root.
I create a new user with root as main group and gnome terminal behaves abnornally just like my old user.

Here is the new user bgpe for testing.

➜  ~ id -Gn bgpe
root docker
➜  ~ 
➜  ~ id -gn bgpe  
root

Last edited by tkit (2019-07-09 09:53:43)

Offline

Board footer

Powered by FluxBB