Add user to a group

dogon23dogon23 Member Posts: 3 ■□□□□□□□□□
I'm using the McGraw Hill Osborne Linux+ Study Guide by Robb Tracy. Chapter 7 - Working with Users and Groups has the following: page 374
"Add you user account and the dtracy user account to the research group by entering groupmod -A "dtracy,your_username" research"

This is supposed to add the 2 users to the research group but it does not I had to enter the following command to add these users to the research group:
adduser dtracy research
adduser jim research

this worked (thank Ubuntu documentation) but the command from the Linux+ book did not. am I missing something here. And yes, I am very new to Linux

thanks

Comments

  • SlowhandSlowhand MCSE: Cloud Platform and Infrastructure, MCSA: Windows Server 2003/2012/2016, CCNA Routing & Switchi Bay Area, CaliforniaMod Posts: 5,161 Mod
    What distro (and version) are you running? Something to keep in mind is that the Linux+ training material usually assumes Fedora, but will sometimes skew off the path and use something else altogether. A lot of commands (no matter how 'standard' they are) don't work on all flavors of Linux.

    Free Microsoft Training: Microsoft Learn
    Free PowerShell Resources: Top PowerShell Blogs
    Free DevOps/Azure Resources: Visual Studio Dev Essentials

    Let it never be said that I didn't do the very least I could do.
  • dogon23dogon23 Member Posts: 3 ■□□□□□□□□□
    thanks for your reply
    I'm using Ununtu 7 and I'm also using the latest distro of Damn Small Linux.
    The adduser <USERNAME> <GROUPNAME> command worked for both of these distros. I am planing on installing Fedora onto a machine this weekend to start playing around with that as well. My concern is that the info in this little lab exercise in the McGraw Hill book in incorrect.
  • SlowhandSlowhand MCSE: Cloud Platform and Infrastructure, MCSA: Windows Server 2003/2012/2016, CCNA Routing & Switchi Bay Area, CaliforniaMod Posts: 5,161 Mod
    I doubt that it's incorrect, (unless they've misspelled a command or screwed up the syntax, in which case you can probably find an errata on their site,) but it's important that you use the same distro they use for the book. In my studies, I found that most of the books assume you're using either Red Hat (Fedora), Debian, and/or Slackware, (which should cover the distros based on them as well, like Ubuntu). If you think you've found a mistake in the book and there's no correction provided by the publisher, don't hesitate to contact them and ask about it.

    I'd recommend first doing a man search on the command the book talks about, see if it's even mentioned by your distro, and then checking the official documentation to see if it's supported. In this case, if they're using a Red Hat based version of Linux, and you're using a Debian-based distro, the commands may not carry over. A good approach is to get yourself VMware or Virtual PC and install a couple of different variations of Linux to test out commands on and work with. You'll find a lot of similarities between distros, but there are differences as well. BSD-based vs. Sys V, RPMs vs. Debian-installer packages vs. tarballs, the various desktop managers, startup processes, etc.

    Free Microsoft Training: Microsoft Learn
    Free PowerShell Resources: Top PowerShell Blogs
    Free DevOps/Azure Resources: Visual Studio Dev Essentials

    Let it never be said that I didn't do the very least I could do.
  • BeaverC32BeaverC32 Member Posts: 670 ■■■□□□□□□□
    The McGraw Hill book is incorrect -- I remember seeing the same error while I was going through the book. Last time I checked, there was no errata available.

    To add a user to a group (while the user already exists) use the command:

    usermod -G [group] [userName]

    As far as I know, the only thing groupmod is capable of is changing the GID or the group name (with root level access).
    MCSE 2003, MCSA 2003, LPIC-1, MCP, MCTS: Vista Config, MCTS: SQL Server 2005, CCNA, A+, Network+, Server+, Security+, Linux+, BSCS (Information Systems)
  • SlowhandSlowhand MCSE: Cloud Platform and Infrastructure, MCSA: Windows Server 2003/2012/2016, CCNA Routing & Switchi Bay Area, CaliforniaMod Posts: 5,161 Mod
    BeaverC32 wrote:
    The McGraw Hill book is incorrect -- I remember seeing the same error while I was going through the book. Last time I checked, there was no errata available.

    To add a user to a group (while the user already exists) use the command:

    usermod -G [group] [userName]

    As far as I know, the only thing groupmod is capable of is changing the GID or the group name (with root level access).

    I believe BeaverC32's right on the money. When doing the TestOut for Linux+, I remember the trainer talking about groupmod being used to modify groups, and usermod being used to modify users. And, since adding a user to a group doesn't actually change the properties of the group, it's considered a usermod function.

    Free Microsoft Training: Microsoft Learn
    Free PowerShell Resources: Top PowerShell Blogs
    Free DevOps/Azure Resources: Visual Studio Dev Essentials

    Let it never be said that I didn't do the very least I could do.
  • dogon23dogon23 Member Posts: 3 ■□□□□□□□□□
    thanks for your replies,
    I have gone through the man pages, the McGraw Hill books uses Fedora and SuSE. I just don't want anyother nubies like myself to read this and come away with false info. This just goes to show you that the best way to learn this it to actually run through all the commands over and over again so you know what does and what does not work.

    thanks
  • SlowhandSlowhand MCSE: Cloud Platform and Infrastructure, MCSA: Windows Server 2003/2012/2016, CCNA Routing & Switchi Bay Area, CaliforniaMod Posts: 5,161 Mod
    dogon23 wrote:
    just goes to show you that the best way to learn this it to actually run through all the commands over and over again so you know what does and what does not work.

    thanks

    Truer words have never been spoken, hands-on experience is important for every cert. With Linux+, using and knowing the command-line tools is especially important, because a lot of questions will ask you what a command does, which command to use for a particular task, or which flag to use when doing a particular task. (Knowing the difference between usermod -g and usermod -G would be useful to know for the test.)

    Free Microsoft Training: Microsoft Learn
    Free PowerShell Resources: Top PowerShell Blogs
    Free DevOps/Azure Resources: Visual Studio Dev Essentials

    Let it never be said that I didn't do the very least I could do.
  • remyforbes777remyforbes777 Member Posts: 499
    A lot of commands are the same from distro to distro, i really don't think that the groupmod command in Red Hat differs from the groupmod command in Debian or ubuntu. I think the book just made a mistake.
  • livenliven Member Posts: 918
    BeaverC32 wrote:
    The McGraw Hill book is incorrect -- I remember seeing the same error while I was going through the book. Last time I checked, there was no errata available.

    To add a user to a group (while the user already exists) use the command:

    usermod -G [group] [userName]

    As far as I know, the only thing groupmod is capable of is changing the GID or the group name (with root level access).


    This is the command I would get used to. It flows across to many other platforms besides linux (i.e. freebsd, solaris, etc...).

    Plus the usermod command has other options that are good for adjusting user accounts. Some folks will actually vi the /etc/group files, but I do not recommend this.
    encrypt the encryption, never mind my brain hurts.
Sign In or Register to comment.