How To Add Together In Addition To Delete A User From A Linux Group

Being inwards the correct Linux grouping expedites many organization direction tasks, in addition to volition salve you lot time. For example, the Apache spider web server logs stimulate got the next file ownership in addition to permissions.

# ls -al /var/log/apache2/*.log
-rw-r----- 1 rootage adm 882984 May eleven 12:14 /var/log/apache2/access.log
-rw-r----- 1 rootage adm 418 May eleven 01:55 /var/log/apache2/error.log
...

To read the Apache logs, you lot demand root permissions. However, at that spot is a shortcut that does non require you lot to operate sudo. Note that adm - the admin grouping for Debian-based systems - is the grouping possessor of the log files. So, if you lot kicking the bucket a fellow member of adm, you lot don't demand to sudo to read the log files.

To add together peter to the adm group, execute whatsoever of the next commands:

  • $ sudo usermod -aG adm peter

  • $ sudo gpasswd -a peter adm

To verify that peter is forthwith a fellow member of the adm group, execute whatsoever of the next commands:

  • $ id -nG peter
    peter adm www-data

    You may live on tempted, equally I was, to non specify peter inwards the higher upwards command. Don't skip the parameter. Without the user parameter, you lot won't encounter the lawsuit of the alter inwards grouping membership - unless you lot log out in addition to log dorsum in. If you lot are running X, it way you lot stimulate got to log out of X, non but opening a novel ascendency rhythm out window inside the same X session.

  • $ groups peter
    peter : peter adm www-data

    Again, specify peter inwards the command. Otherwise, you lot must log out in addition to and thus log dorsum inwards before executing the command.

  • $ grep adm /etc/group
    adm:x:4:peter

If you lot stimulate got made a mistake, in addition to forthwith desire to take away peter from the adm group, operate whatsoever of the next commands:

  • $ sudo gpasswd -d peter adm
    Removing user peter from grouping adm

  • $ sudo deluser peter adm
    Removing user `peter' from grouping `adm' ...
    Done.

Besides the adm group, you lot should reckon adding yourself to the www-data group. The Apache spider web server runs nether the www-data user concern human relationship on Debian systems. As a fellow member of the www-data group, you lot tin shipping away to a greater extent than easily modify spider web server files in addition to directories.

An before post on grouping membership appears here.

Berlangganan update artikel terbaru via email:

0 Response to "How To Add Together In Addition To Delete A User From A Linux Group"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel