'sudo id -G <username>' vs 'id -G' issue

Ralf Mardorf silver.bullet at zoho.com
Thu Nov 3 11:40:15 UTC 2016


On Thu, 03 Nov 2016 20:53:12 +1100, Karl Auer wrote:
>It's not clear to me what you are actually trying to do, or why you
>would need to change a logged-in user's group memberships... something
>I am fairly sure is not possible.

From Ubuntu flavour live media I want to get access to data partitions,
without root privileges. Those data partition are usually accessible for
uid 1000 and gid 1000. Unfortunately the live media users have got
uid 999 and gid 999. Btw. the media come without the package
systemd-container installed. I'm aware that they aren't intended as
rescue or backup media, but why not using an Ubuntu flavour live media
for this tasks? I don't want to use one of those old school rescue
media, that come without systemd and bizarre graphical user interfaces
and I don't want to make my own ISO. It would be nice to use a common
graphical user interface and to access installs by systemd-nspawn and
by the GUI as regular user without root privileges, from a downloaded
Ubuntu flavour live media. I first tested lubuntu, a flavour
definitively made by a team who has got no concept at all. The most
worse distro I've ever tested, nobody should use lubuntu, instead
install ubuntu and then openbox and/or lxde. Now I'm testing
ubuntu-mate and it seems to be well done, just not absolutely perfect
regarding my needs, so I wrote a script with many gsettings and dconf
commands, removing and installing packages etc.. In short, I wont to be
able to download and burn an default Ubuntu flavour live media, to run
a script and to get what I want. Actually I could add the user to the
group 1000 and restart the display manager. What I tried to archive was
to offer restarting the display manager only if it's useful, after

id -G ubuntu-mate | grep 1000 >/dev/null
if [ $? -ne 0 ]; then

which fails, since I need to access the script with root privileges
from one of the mentioned partitions that require uid or gid 1000, so
the $? is always equal 0, as soon as the group exists and the user is
member of this group, even if restarting the display manager still
should be required.

Regards,
Ralf





More information about the ubuntu-users mailing list