fix(netrc): review notes

This commit is contained in:
Michele Cereda
2026-01-27 18:57:34 +01:00
parent ae4102b65e
commit f790eabb4e

View File

@@ -2,34 +2,35 @@
Specifies automatic login information for the `ftp` and `rexec` commands.
It is located under a user's home directory (`~/.netrc`) and must be owned
either by the user executing the command or by the root user.
If the .netrc file contains a login password, the file's permissions must be set
to `600` (read and write by its owner only).
## Table of contents <!-- omit in toc -->
1. [TL;DR](#tldr)
1. [Format](#format)
1. [Further readings](#further-readings)
## TL;DR
Located under a user's home directory (`~/.netrc`).<br/>
It **must** be owned by either the user executing the command, or by the `root` user.<br/>
If a `.netrc` file contains a login password, the file's permissions **must** be set to `600` (read and write for its
owner only).
## Format
The file can contain the following entries separated by spaces, tabs, or new
lines:
The file can contain the following entries separated by spaces, tabs, or new lines:
- `machine` _hostname_: this begins the definition of the automatic login
process for the specified _hostname_; all the following entries, up to a new
`machine` entry or the end of the file, will apply to _hostname_
- `default`: like `machine`, but matches any hostname; there can be only 1 in
the whole file and it is considered the last entry (entries following it will
be ignored)
- `login` _username_: the full domain user name used for authentication; if
found the automatic login process initiates a login with the specified
_username_, else it will fail
- `password` _password_: the password to use for authentication; it must be
set at the remote host and must be present in `.netrc`, otherwise the process
will fail and the user is prompted for a new value
> passwords in this fields cannot contain spaces
- `machine` _hostname_: starts the definition of the automatic login process for the specified _hostname_.<br/>
All entries following this key, up to a new `machine` entry or the end of the file, will apply to just the specified
_hostname_.
- `default`: works like `machine`, but matches **any** hostname.<br/>
There can be only 1 in the whole file, and it must the last entry. Entries following this key will be ignored.
- `login` _username_: the full user name used for authentication; if found, the automatic login process initiates a
login with the specified _username_, otherwise it will fail.
- `password` _password_: the password to use for authentication.<br/>
It **must** be set at the remote host, and must be present in `.netrc`. Otherwise, the process will fail and the user
will be prompted for a new value.
> [!warning]
> Passwords in this fields **cannot** contain spaces.
The two formats below are equivalent:
@@ -52,7 +53,8 @@ password bluebonnet
- [netrc]
<!--
References
Reference
═╬═Time══
-->
<!-- Others -->