10

I have a weird problem in that my user (on Linux Mint 18.3 Sylvia) is part of group docker, which I verify by starting a terminal:

$ groups
me adm cdrom sudo dip plugdev lpadmin sambashare docker

Now, when I fire up tmux, and run the same command, suddenly my docker membership disappears:

$ tmux
$ groups
me adm cdrom sudo dip plugdev lpadmin sambashare

The weird thing is, when I attempt to forcibly add my user to the group docker when in tmux, it says I'm already in it!

$ sudo adduser me docker
The user `me' is already a member of `docker'.

I'm stumped -- why would being in tmux make a difference? For reference, I use fish shell and this is my .tmux.conf:

$ cat ~/config/.tmux.conf 
new-session
set -g default-terminal "screen-256color"
set -g history-limit 10000
setw -g mode-keys vi
set-option -g default-shell /usr/bin/fish
set-option -g default-command /usr/bin/fish

EDIT

When I restarted my computer, everything worked again (both tmux and "normal" shells showed my docker membership). I'm still curious -- why did this happen?

ilkkachu
  • 138,973

4 Answers4

3

The most likely explanation for this is that the tmux session was started before you added your user to the docker group. Note that you can log out without terminating an active tmux session, but that this session would not be affected by changes in group memberships when you re-attach to it after logging in again later.

In your edit to the question you say that when you started a new tmux session (after a reboot), the user shows up as member of the docker group. This is expected as you now have a tmux session started from an environment where the group memberships had been altered.

Kusalananda
  • 333,661
2

I just had the same issue. I had to close all existing tmux sessions. After that, all new tmux sessions inherited the correct groups.

schreon
  • 121
0

You can delete your tmux session file:

rm /tmp/tmux-1000 # example for uid 1000

Then start a new session and see that you are a member of the group.

0
  • Killing the tmux-server and then starting a new session fixed it for me.
  • tmux kill-server
  • tmux new -s ...
  • Also ensure you exit the current terminal session and start a new terminal after modifying a user/group for the changes to take effect.
Loner
  • 1
  • 1