/etc/passwd and "&" char

Trond Endrestøl Trond.Endrestol at fagskolen.gjovik.no
Mon Oct 29 08:31:55 UTC 2012


On Mon, 29 Oct 2012 08:28-0000, jb wrote:

> Hi,
> 
> Question:
> What is the purpose of the "&" char in GECOS fields, e.g. user's name field, in
> /etc/passwd file ?
> 
> $ grep "&" /etc/passwd
> root:*:0:0:Charlie &:/root:/bin/csh
> operator:*:2:5:System &:/:/usr/sbin/nologin
> svn:*:1002:1002:User &:/home/svn:/usr/sbin/nologin

>From passwd(5):

     The full name may contain a ampersand (`&') which will be replaced by the
     capitalized login name when the gecos field is displayed or used by vari-
     ous programs such as finger(1), sendmail(8), etc.

> The field containing "&" char represents "-c comment" option in pw(8), which
> sets up GECOS fields (user's full name, etc).
> 
> The pw(8) states further:
> ...
>      The pw utility allows 8-bit characters in the passwd GECOS field ...
>      ...
>                                 Using 8-bit characters may also affect other
>      programs that transmit the contents of the GECOS field over the Internet,
>      such as fingerd(8), and a small number of TCP/IP clients, such as IRC,
>      where full names specified in the passwd file may be used by default.
> ...
> 
> http://en.wikipedia.org/wiki/Ampersand
> ...
> Encoding and display
> ...
> Programming languages
> ...
>   The ampersand character is used as a special character in at least some
>   versions of the database software originally created in Denmark under the
>   name Navision (the software has since been acquired by Microsoft). Using this
>   character in either "Text" or "Code" fields could create difficulties for
>   performing certain tasks in Navision, such as filtering records (either by
>   the user or by programming). It is also used as described below to indicate
>   shortcuts in menu items and lab els.
> ...
> Text markup
>   In SGML, XML, and HTML, ... This creates what is known as the ampersand
>   problem. ...
> ...
> Unix shells
> ...
> Web standards
> ...
> 
> Google search results for "& character":
> Special (escape) characters in SGML, HTML and XML documents:
> &   &   &       ampersand
> 
> jb

-- 
+-------------------------------+------------------------------------+
| Vennlig hilsen,               | Best regards,                      |
| Trond Endrestøl,              | Trond Endrestøl,                   |
| IT-ansvarlig,                 | System administrator,              |
| Fagskolen Innlandet,          | Gjøvik Technical College, Norway,  |
| tlf. mob.   952 62 567,       | Cellular...: +47 952 62 567,       |
| sentralbord 61 14 54 00.      | Switchboard: +47 61 14 54 00.      |
+-------------------------------+------------------------------------+


More information about the freebsd-questions mailing list