GithubHelp home page GithubHelp logo

Comments (7)

langston-barrett avatar langston-barrett commented on August 16, 2024

Interesting! Do you know of a more authoritative source of knowledge distributive could pull from? You mentioned both "validating with ID" and "groups commands", could you expand on those? I guess the problem is I just didn't understand how groups worked enough when I implemented this 😛

from distributive.

zahartx avatar zahartx commented on August 16, 2024

The commands id or groups will work, however the format is different. One might be easier to parse but both commands will get all groups a user is associated with.

id testuser
uid=40274(testuser) gid=100(users) groups=100(users),20(games),99(nobody)

or

groups testuser
testuser : users games nobody

from distributive.

langston-barrett avatar langston-barrett commented on August 16, 2024

That's true, but then distributive would have to log in as that user, which often will not be possible or desirable. Would parsing /etc/passwd in addition to /etc/groups provide a complete picture?

from distributive.

zahartx avatar zahartx commented on August 16, 2024

Any user should be able to run id or groups. Parsing both /etc/passwd and /etc/group will also work. /etc/passwd will contain the primary group and /etc/group will contain all secondary groups. Either approach will get the job done!

whoami
testuser

id root
uid=0(root) gid=0(root) groups=0(root)

groups root
root : root

id testuser
uid=40274(testuser) gid=100(users) groups=100(users),20(games),99(nobody)

groups testuser
testuser : users games nobody
grep testuser /etc/passwd
testuser:x:40274:100::/home/testuser:/bin/bash

The primary group is 100 which is users.

grep testuser /etc/group
games:x:20:testuser
nobody:x:99:testuser
users:x:100:testuser
testuser:x:40274:

The secondary groups are listed in /etc/group.

from distributive.

langston-barrett avatar langston-barrett commented on August 16, 2024

Great, thanks for enlightening me :) I'll get to work on this ASAP! If you'd like to contribute as well, I'm happy to help you get started!

from distributive.

zahartx avatar zahartx commented on August 16, 2024

Sure, send any info my way. I wouldn't mind contributing.

from distributive.

langston-barrett avatar langston-barrett commented on August 16, 2024

Here's where the action is. If you can provide an equivalent way to parse /etc/passwd and merge the results, that would fix the issue! It could almost definitely be based on tabular's functions as well.

To start work, you can just clone the repo and make a new branch, push your changes to your clone, and then make a pull request and I'll review it! Make sure to use go fmt on your changes.

from distributive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.