Running Ubuntu 12.04, I setup a private git server and created a group called git some time ago. Now I am following a guide to install gitlab and when it came to adding a user to the git group and create it, I saw that I already had it.

The command is this:

sudo adduser --disabled-login --gecos 'GitLab' git

taken from Gitlab installation Tutorial.

I would like to understand that command correctly. For me I thought I add a user to a group like this:

adduser user group

So what do --disabled-login and --gecos stand for?

2 Answers 2


It's all written in the manual page!

enter image description here

You don't need to install something, to search on google or to have an internet connection. Just open your terminal and first of all you must to run the following command:

man adduser

to open the manual page for adduser command.

Then, in that manual page type: /--disabled-login followed by Enter then press repetitively n to find all occurrences containing --disabled-login. Do the same for --gecos.

With a little bit of luck you will find out that:

          Do not run passwd to set the password.  The user won't be able 
          to use  her  account until the password is set.


--gecos GECOS
          Set  the  gecos field for the new entry generated.  adduser will 
          not ask for finger information if this option is given.

For those wondering what gecos actually is, wikipedia defines it as follows:

The gecos field, or GECOS field is an entry in the /etc/passwd file on Unix, and similar operating systems. It is typically used to record general information about the account or its user(s) such as their real name and phone number.

  • 3
    damn never knew about that kind of manual. Thank you sir.
    – Private
    Feb 14, 2014 at 13:32
  • 60
    Actually GECOS is really badly explained in the manpage. It's the part where it asks for real name, phone etc. en.wikipedia.org/wiki/Gecos_field
    – benjaoming
    Jan 11, 2016 at 14:55
  • 32
    This answers does not explain what gecos is. I came here looking for this info too. Nor does it explain that --disabled-login does not actually disable login as the man implies. it just disables login via password. It is usually used when you set the certificate for cert based ssh login. May 22, 2018 at 17:59
  • 12
    What a terrible answer. I specifically came here because the format for the GECOS option was not sufficiently explained in the manpage.
    – Rörd
    Sep 3, 2019 at 13:41
  • This answer should not be marked as the correct one as it does not answer the OPs question. Feb 4 at 19:44

--disabled-login, which is similar to --disabled-password, is used to create the user account without any password and to avoid prompting for it. This is to avoid any attempt to log in as git on your Git server. The reason for this is that you're not supposed to log in to it directly, you're supposed to interact with it via git commands only.

--gecos sets additional information about the user you're creating (and doesn't have anything in particular to do with git). It's not in much use these days. If you set gecos values for an account, other users can read that information using the finger command so they can get more information about him/her/it. You can also set it separately with the chfn command. The --gecos switch is intended to be followed by five comma-separated values which serves as additional comments about the user. The values are:

  1. Full name
  2. Room number
  3. Work phone
  4. Home phone
  5. Other

You can leave out any value and skip the ends, for example --gecos 'Donald Trump,3' would work, as would 'Donald Trump,3,,,President'.

The main reasons why you're asked to use the --gecos option is, I guess, to avoid prompts for these values, they are just annoying and don't make much sense these days, and may actually be a security risk. Never put your personal data here!


According to Wikipedia, some early Unix systems at Bell Labs used GECOS (General Comprehensive Operating System) machines, so this field was added to carry information on a user's GECOS identity.

  • 2
    has anyone got a good way of making that the default? Ah it was simple: alias adduser='adduser --gecos ""'
    – wuxmedia
    Jun 26, 2020 at 10:14
  • Sure. Another way to do it would be to just download Linux source code, update adduser and recompile. Both alternatives are probably equally bad. My point is, adduser should behave in a standard way since it heavily affects security. And aliases are typically set individually by each user. Which user should set this alias?
    – Rein
    Jun 27, 2020 at 16:20
  • root should, being the only user who can create users? Yes aliases are not the best answer, slightly better than recompiling or mashing enter 5 times.
    – wuxmedia
    Jun 28, 2020 at 14:55
  • I hope you caught my irony about recompilation! If you add just a few users I think those extra presses on the same key (enter) still is quicker than adding an alias to /root/.bashrc. If in fact you have tons of users to add regularly, I guess you have their names in some file anyway so you could write a short bash script that feeds them to adduser or maybe even better useradd (perhaps you need to tweak a bit with awk and sed). This way you avoid confusing other administrators who runs adduser. Still, I doubt this is a big issue, off topic and doesn't add any value to the original question.
    – Rein
    Jun 29, 2020 at 17:42
  • 1
    Excellent explanation: "--gecos switch is intended to be followed by five comma-separated values..."
    – Enterprise
    Jul 10, 2021 at 4:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .