Skip to content

a replacement part for missing -a -G functionality in usermod

Notifications You must be signed in to change notification settings

mcandre/useless

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

useless: a replacement part for missing -a -G functionality in usermod

ABOUT

useless emits an augmented copy of a UNIX group file, with the configured group's entry modified to append the desired username. This shim is useful for automatically updating groups in environments where a system's usermod command omits the typical -a, -G flags to perform this operation.

For manual group changes, nano, cat, echo, etc. can safely edit the /etc/group file. However, this requires some care to avoid accidentally corrupting the file. This shim provides a more reliable, automated workflow, intended for system administrators, Continuous Integration servers, virtual machine configuration, and so on.

EXAMPLE

$ sudo cp /etc/group /etc/group.bak

$ USERNAME=beer GROUP=party su user -c 'awk -f lib/useless.awk < /etc/group > /etc/group.new'

$ diff /etc/group /etc/group.new
3c3
< party:x:101:sshd,user
---
> party:x:101:sshd,user,beer

$ sudo cp /etc/group.new /etc/group

REQUIREMENTS

  • GNU awk

Recommended

  • diff

INSTALL

  1. Clone https://github.com/mcandre/useless.git

About

a replacement part for missing -a -G functionality in usermod

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages