You are not logged in.

#1 2011-07-11 04:16:37

richardm198030
Member
Registered: 2011-02-10
Posts: 81

useradd

Anybody here know Forum Syntax?

I was reading through useradd in the wiki and came across this line:

useradd -m -g users -G audio,video,etc, etc -s /bin/bash username and it never added my username to users.

I tried it like this:

useradd -m -G audio,video,etc.etc -s /bin/bash username;  // That worked fine, now why didn't it work in the first line I showed??  Either way, the second line worked.. 

Thought I'd leave a post about it. 

I was also thinking useradd -m -g users -G audio,video,etc.etc -s /bin/bash username keeps users out of the /etc/group file, but I'm thinking I am wrong on that part.

IF anybody does, and notices the same issue, then maybe somebody who knows Forums Syntax can update wiki and remove the -g users part.

Offline

#2 2011-07-11 04:41:53

ren2r
Member
From: Bahia, Brasil
Registered: 2011-06-22
Posts: 25

Re: useradd

In my system the code that you provided works normal, and I get the username in group users, just login in account and type "groups".
about the file /etc/group, it does not show the user name inside, the username is shown in /etc/passwd.
if you wanna create a group with same name of username you should you use the option "-U" (is more like ubuntu that create a group with your username), because the option "-m" only set your default group.

Sorry if I misunderstood.


~/ren2r ...sorry my ugly english

Offline

#3 2011-07-11 04:45:57

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,079

Re: useradd

Please don't start threads in Forum & Wiki discussion. This forum is meant for discussing changes in wiki articles and forums itself.

If you have questions regarding something, look for an appropriate sub-forum.

Moving to Newbie Corner...


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#4 2011-07-11 05:01:57

richardm198030
Member
Registered: 2011-02-10
Posts: 81

Re: useradd

ren2r wrote:

In my system the code that you provided works normal, and I get the username in group users, just login in account and type "groups".
about the file /etc/group, it does not show the user name inside, the username is shown in /etc/passwd.
if you wanna create a group with same name of username you should you use the option "-U" (is more like ubuntu that create a group with your username), because the option "-m" only set your default group.

Sorry if I misunderstood.

No no, I thought maybe there was possibly something I wasn't understanding about that..   Anyway, the second line I showed worked fine...  I was just trying to be lazy and just do it all at once, rather than typing gpasswd -a username group, LOL..

Offline

#5 2011-07-11 14:23:53

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: useradd

*sigh*

useradd -m -g users -G audio,video,etc, etc -s /bin/bash username

Guys, guys - use your brainwaves a little bit ...

How often have you seen the phrase:
whatever whatever etc, etc - the 'etc' part is a manner of speech - it means 'etcetera' (and that can be looked up in an encyclopedia!)
Also - if you do a 'man useradd' or just run the command 'useradd' without any arguments you will see that the quoted line is syntactically incorrect - it is trying to add a user called 'etc'

When it was changed to 'etc.etc' it became syntactically correct, which is why it was accepted - however - there is no group called 'etc' or 'etc.etc'.
Granted, you can create a group called 'etc' or 'etc.etc', however, I doubt very much that that was the intention of the command.

'man' is your friend!!

Oh and by-the-way - the '-m' option creates the home directory for the user if it doesn't exist (man useradd!!)
- and, the username _is_ found in the /etc/group file for all other groups but the primary one.
Just try a 'grep root /etc/group'

Last edited by perbh (2011-07-11 14:31:48)

Offline

#6 2011-07-11 17:50:46

jgreen1tc
Member
From: St. Louis
Registered: 2011-05-16
Posts: 247

Re: useradd

I don't think the OP meant he actually typed "etc"...I think he was using it to illustrate that he typed all the groups he wanted the user to be in (he was actually using the manner of speech you were referring to) and that

useradd -m -g users -G (other groups) /bin/bash username

didnt work for him, but

useradd -m -G (groups) /bin/bash username

did work. At least that's my understanding of the situation.

Last edited by jgreen1tc (2011-07-11 17:55:51)

Offline

#7 2011-07-11 18:36:41

richardm198030
Member
Registered: 2011-02-10
Posts: 81

Re: useradd

perbh wrote:

*sigh*

useradd -m -g users -G audio,video,etc, etc -s /bin/bash username

Guys, guys - use your brainwaves a little bit ...

How often have you seen the phrase:
whatever whatever etc, etc - the 'etc' part is a manner of speech - it means 'etcetera' (and that can be looked up in an encyclopedia!)
Also - if you do a 'man useradd' or just run the command 'useradd' without any arguments you will see that the quoted line is syntactically incorrect - it is trying to add a user called 'etc'

When it was changed to 'etc.etc' it became syntactically correct, which is why it was accepted - however - there is no group called 'etc' or 'etc.etc'.
Granted, you can create a group called 'etc' or 'etc.etc', however, I doubt very much that that was the intention of the command.

'man' is your friend!!

Oh and by-the-way - the '-m' option creates the home directory for the user if it doesn't exist (man useradd!!)
- and, the username _is_ found in the /etc/group file for all other groups but the primary one.
Just try a 'grep root /etc/group'

Umm, the etc, was just an illustration like the last post said.  And yah, I knew what -m does..

Offline

#8 2011-07-11 18:37:47

richardm198030
Member
Registered: 2011-02-10
Posts: 81

Re: useradd

jgreen1tc wrote:

I don't think the OP meant he actually typed "etc"...I think he was using it to illustrate that he typed all the groups he wanted the user to be in (he was actually using the manner of speech you were referring to) and that

useradd -m -g users -G (other groups) /bin/bash username

didnt work for him, but

useradd -m -G (groups) /bin/bash username

did work. At least that's my understanding of the situation.


What OP?  LOL..  You understood what I meant perfectly jgreen1tc

Offline

#9 2011-07-12 04:44:36

Awebb
Member
Registered: 2010-05-06
Posts: 4,638

Re: useradd

The OP should also know by now, that "didn't work" is no valid placeholder for shell output of the error :-D

Offline

#10 2011-07-12 04:46:24

richardm198030
Member
Registered: 2011-02-10
Posts: 81

Re: useradd

Awebb wrote:

The OP should also know by now, that "didn't work" is no valid placeholder for shell output of the error :-D

Whoops, sorry, typo, what does OP mean?

Offline

#11 2011-07-12 06:01:33

cjazz
Member
Registered: 2009-03-12
Posts: 45

Re: useradd

richardm198030 wrote:

Whoops, sorry, typo, what does OP mean?


See definition 1.

Offline

#12 2011-07-12 07:57:00

richardm198030
Member
Registered: 2011-02-10
Posts: 81

Re: useradd

cjazz wrote:
richardm198030 wrote:

Whoops, sorry, typo, what does OP mean?


See definition 1.

LOL, Definition one is resorting to gaming..  OP I found out was Original Poster.

Offline

#13 2011-07-12 10:51:39

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 3,762

Re: useradd

I would suggest taking a look at adduser too. It is more friendly for interactive use.


Evil #archlinux@freenode channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

Board footer

Powered by FluxBB