Can someone please tell me how to logout and log back in again via the command line so that I can apply a new group's settings to a user. To put this in perspective, assume that I am currently logged in as testuseraccount, and then I  issue the commands below into the terminal.suusermod -aG sudo testuseraccountSo I believe by typing su this logs me into root (but just within the shell). So how do I logout of root, then logout of testuseraccount & sign back in (in order to apply the sudo group to testusersaccount) via the terminal?
How To Logout and Apply New Group Settings
login;group;session
You cannot change existing processes' group id, which means one way is to restart them.  Child processes inherit the parent's group id, so programs you start in your deskop environment (menu...) you cannot influence.Within a given shell, use the newgrp command to start a new shell with the new effective group id:> iduid=1000(user) gid=100(users) groups=100(users),92(audio)> newgrp audio> iduid=1000(user) gid=92(audio) groups=92(audio),100(users)Any process started from this shell will have the new effective group id (audio in this case).If you have added a new user to a group this will again take effect after the user starts a new process.As a consequence, if you wish to start a new X (graphical login) session, you need to exit the previous session completely, then start the new session by logging in.  Logging back in without interaction after logging out is not intended to be possible by the login screen (by XDM/GDM/KDM) unless passwordless login is enabled (which no-one recommends).  One reason is that during logout, all processes of the user are to be terminated, so no process is left to initiate logging you in.Workarounds may be created but will be ugly, I expect.