{
    "mode": "man",
    "parameter": "XAUTH",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/XAUTH/1/json",
    "generated": "2026-08-31T21:51:50Z",
    "synopsis": "xauth [ -f authfile ] [ -vqibn ] [ command arg ... ]",
    "sections": {
        "NAME": {
            "content": "xauth - X authority file utility\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "xauth [ -f authfile ] [ -vqibn ] [ command arg ... ]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The  xauth program is used to edit and display the authorization information used in connect‐\ning to the X server.  This program is usually used to extract authorization records from  one\nmachine and merge them in on another (as is the case when using remote logins or granting ac‐\ncess  to other users).  Commands (described below) may be entered interactively, on the xauth\ncommand line, or in scripts.  Note that this program does not contact  the  X  server  except\nwhen  the  generate command is used.  Normally xauth is not used to create the authority file\nentry in the first place; the program that starts the X server (often  xdm  or  startx)  does\nthat.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The  following  options may be used with xauth.  They may be given individually (e.g., -q -i)\nor may combined (e.g., -qi).\n",
            "subsections": [
                {
                    "name": "-f _",
                    "content": "This option specifies the name of the authority file to use.  By default, xauth  will\nuse  the  file specified by the XAUTHORITY environment variable or .Xauthority in the\nuser's home directory.\n",
                    "flag": "-f"
                },
                {
                    "name": "-q",
                    "content": "status  messages.   This  is  the default if an xauth command is given on the command\nline or if the standard output is not directed to a terminal.\n",
                    "flag": "-q"
                },
                {
                    "name": "-v",
                    "content": "indicating  the  results of various operations (e.g., how many records have been read\nin or written out).  This is the default if xauth is reading commands from its  stan‐\ndard input and its standard output is directed to a terminal.\n",
                    "flag": "-v"
                },
                {
                    "name": "-i",
                    "content": "xauth will refuse to read or edit any authority files that have been locked by  other\nprograms (usually xdm or another xauth).\n",
                    "flag": "-i"
                },
                {
                    "name": "-b",
                    "content": "fore proceeding.  Use this option only to clean up stale locks.\n",
                    "flag": "-b"
                },
                {
                    "name": "-n",
                    "content": "should simply always print the host address as stored in the authority file.\n",
                    "flag": "-n"
                },
                {
                    "name": "-V",
                    "content": "",
                    "flag": "-V"
                }
            ]
        },
        "COMMANDS": {
            "content": "The following commands may be used to manipulate authority files:\n\nadd displayname protocolname hexkey\nAn authorization entry for the indicated display using the  given  protocol  and  key\ndata  is  added to the authorization file.  The data is specified as an even-lengthed\nstring of hexadecimal digits, each pair representing one octet.  The first  digit  of\neach pair gives the most significant 4 bits of the octet, and the second digit of the\npair  gives  the  least significant 4 bits.  For example, a 32 character hexkey would\nrepresent a 128-bit value.  A protocol name consisting of just  a  single  period  is\ntreated as an abbreviation for MIT-MAGIC-COOKIE-1.\n\n\ngenerate displayname protocolname [trusted|untrusted]\n[timeout seconds] [group group-id] [data hexdata]\n\nThis command is similar to add.  The main difference is that instead of requiring the\nuser  to  supply the key data, it connects to the server specified in displayname and\nuses the SECURITY extension in order to get the key data to store in  the  authoriza‐\ntion  file.  If the server cannot be contacted or if it does not support the SECURITY\nextension, the command fails.  Otherwise, an authorization entry  for  the  indicated\ndisplay using the given protocol is added to the authorization file.  A protocol name\nconsisting  of  just  a  single  period  is treated as an abbreviation for MIT-MAGIC-\nCOOKIE-1.\n\nIf the trusted option is used, clients that connect  using  this  authorization  will\nhave  full  run of the display, as usual.  If untrusted is used, clients that connect\nusing this authorization will be considered untrusted and prevented from stealing  or\ntampering  with data belonging to trusted clients.  See the SECURITY extension speci‐\nfication for full details on the restrictions imposed on untrusted clients.  The  de‐\nfault is untrusted.\n\nThe  timeout  option  specifies how long in seconds this authorization will be valid.\nIf the authorization remains unused (no clients are connected  with  it)  for  longer\nthan  this  time  period, the server purges the authorization, and future attempts to\nconnect using it will fail.  Note that the purging done by the server does not delete\nthe authorization entry from the authorization file.  The default timeout is 60  sec‐\nonds.\n\nThe  group  option  specifies the application group that clients connecting with this\nauthorization should belong to.  See the application  group  extension  specification\nfor more details.  The default is to not belong to an application group.\n\nThe  data option specifies data that the server should use to generate the authoriza‐\ntion.  Note that this is not the same data that gets  written  to  the  authorization\nfile.   The  interpretation  of this data depends on the authorization protocol.  The\nhexdata is in the same format as the hexkey described in the add  command.   The  de‐\nfault is to send no data.\n\n\n[n]extract filename displayname...\nAuthorization entries for each of the specified displays are written to the indicated\nfile.   If  the nextract command is used, the entries are written in a numeric format\nsuitable for non-binary transmission (such as secure electronic mail).  The extracted\nentries can be read back in using the merge and nmerge  commands.   If  the  filename\nconsists of just a single dash, the entries will be written to the standard output.\n\n[n]list [displayname...]\nAuthorization  entries  for each of the specified displays (or all if no displays are\nnamed) are printed on the standard output.  If the nlist  command  is  used,  entries\nwill be shown in the numeric format used by the nextract command; otherwise, they are\nshown  in  a  textual format.  Key data is always displayed in the hexadecimal format\ngiven in the description of the add command.\n\n[n]merge [filename...]\nAuthorization entries are read from the specified files and are merged into  the  au‐\nthorization  database,  superseding any matching existing entries. If the nmerge com‐\nmand is used, the numeric format given in the description of the extract  command  is\nused.   If a filename consists of just a single dash, the standard input will be read\nif it hasn't been read before.\n\nremove displayname...\nAuthorization entries matching the specified displays are removed from the  authority\nfile.\n\nsource filename\nThe  specified  file  is  treated  as  a script containing xauth commands to execute.\nBlank lines and lines beginning with a sharp sign (#) are ignored.  A single dash may\nbe used to indicate the standard input, if it hasn't already been read.\n\ninfo    Information describing the authorization file, whether or not any changes  have  been\nmade, and from where xauth commands are being read is printed on the standard output.\n\nexit    If  any modifications have been made, the authority file is written out (if allowed),\nand the program exits.  An end of file is treated as an implicit exit command.\n\nquit    The program exits, ignoring any modifications.  This  may  also  be  accomplished  by\npressing the interrupt character.\n\nversion This command shows the version number of the xauth executable.\n\nhelp [string]\nA description of all commands that begin with the given string (or all commands if no\nstring is given) is printed on the standard output.\n\n?       A short list of the valid commands is printed on the standard output.\n",
            "subsections": []
        },
        "DISPLAY NAMES": {
            "content": "Display  names  for  the add, [n]extract, [n]list, [n]merge, and remove commands use the same\nformat as the DISPLAY environment variable and the common  -display  command  line  argument.\nDisplay-specific  information (such as the screen number) is unnecessary and will be ignored.\nSame-machine connections (such as local-host sockets, shared memory, and the Internet  Proto‐\ncol  hostname localhost) are referred to as hostname/unix:displaynumber so that local entries\nfor different machines may be stored in one authority file.\n",
            "subsections": []
        },
        "EXAMPLE": {
            "content": "The most common use for xauth is to extract the entry for the current display, copy it to an‐\nother machine, and merge it into the user's authority file on the remote machine:\n\n%  xauth extract - $DISPLAY | ssh otherhost xauth merge -\n\nThe following command contacts the server :0 to create an authorization using the  MIT-MAGIC-\nCOOKIE-1 protocol.  Clients that connect with this authorization will be untrusted.\n%  xauth generate :0 .\n",
            "subsections": []
        },
        "ENVIRONMENT": {
            "content": "This xauth program uses the following environment variables:\n\nXAUTHORITY\nto get the name of the authority file to use if the -f option isn't used.\n\nHOME    to get the user's home directory if XAUTHORITY isn't defined.\n",
            "subsections": []
        },
        "FILES": {
            "content": "$HOME/.Xauthority\ndefault authority file if XAUTHORITY isn't defined.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "X(7), Xsecurity(7), xhost(1), Xserver(1), xdm(1), startx(1), Xau(3).\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Users  that have insecure networks should take care to use encrypted file transfer mechanisms\nto copy authorization entries between machines.  Similarly, the  MIT-MAGIC-COOKIE-1  protocol\nis  not  very useful in insecure environments.  Sites that are interested in additional secu‐\nrity may need to use encrypted authorization mechanisms such as Kerberos.\n\nSpaces are currently not allowed in the protocol name.  Quoting could be added for the  truly\nperverse.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Jim Fulton, MIT X Consortium\n\nX Version 11                                 xauth 1.1.2                                    XAUTH(1)",
            "subsections": []
        }
    },
    "summary": "xauth - X authority file utility",
    "flags": [
        {
            "flag": "-f",
            "long": null,
            "arg": null,
            "description": "This option specifies the name of the authority file to use. By default, xauth will use the file specified by the XAUTHORITY environment variable or .Xauthority in the user's home directory."
        },
        {
            "flag": "-q",
            "long": null,
            "arg": null,
            "description": "status messages. This is the default if an xauth command is given on the command line or if the standard output is not directed to a terminal."
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": "indicating the results of various operations (e.g., how many records have been read in or written out). This is the default if xauth is reading commands from its stan‐ dard input and its standard output is directed to a terminal."
        },
        {
            "flag": "-i",
            "long": null,
            "arg": null,
            "description": "xauth will refuse to read or edit any authority files that have been locked by other programs (usually xdm or another xauth)."
        },
        {
            "flag": "-b",
            "long": null,
            "arg": null,
            "description": "fore proceeding. Use this option only to clean up stale locks."
        },
        {
            "flag": "-n",
            "long": null,
            "arg": null,
            "description": "should simply always print the host address as stored in the authority file."
        },
        {
            "flag": "-V",
            "long": null,
            "arg": null,
            "description": ""
        }
    ],
    "examples": [
        "The most common use for xauth is to extract the entry for the current display, copy it to an‐",
        "other machine, and merge it into the user's authority file on the remote machine:",
        "%  xauth extract - $DISPLAY | ssh otherhost xauth merge -",
        "The following command contacts the server :0 to create an authorization using the  MIT-MAGIC-",
        "COOKIE-1 protocol.  Clients that connect with this authorization will be untrusted.",
        "%  xauth generate :0 ."
    ],
    "see_also": [
        {
            "name": "X",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/X/7/json"
        },
        {
            "name": "Xsecurity",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/Xsecurity/7/json"
        },
        {
            "name": "xhost",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/xhost/1/json"
        },
        {
            "name": "Xserver",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/Xserver/1/json"
        },
        {
            "name": "xdm",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/xdm/1/json"
        },
        {
            "name": "startx",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/startx/1/json"
        },
        {
            "name": "Xau",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/Xau/3/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Edit and display the authorization information used in connecting to the X server.",
        "examples": [
            {
                "description": "Start interactive mode with a specific authority file (defaults to `~/.Xauthority`)",
                "command": "xauth -f {{path/to/file}}"
            },
            {
                "description": "Display information about the authority file",
                "command": "xauth info"
            },
            {
                "description": "Display authorization entries for all the displays",
                "command": "xauth list"
            },
            {
                "description": "Add an authorization for a specific display",
                "command": "xauth add {{display_name}} {{protocol_name}} {{key}}"
            },
            {
                "description": "Remove the authorization for a specific display",
                "command": "xauth remove {{display_name}}"
            },
            {
                "description": "Print the authorization entry for the current display to `stdout`",
                "command": "xauth extract - $DISPLAY"
            },
            {
                "description": "Merge the authorization entries from a specific file into the authorization database",
                "command": "cat {{path/to/file}} | xauth merge -"
            },
            {
                "description": "Display help",
                "command": "xauth --help"
            }
        ]
    }
}