From f790eabb4eddc160f57c25255ef6449b9452fe66 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Tue, 27 Jan 2026 18:57:34 +0100 Subject: [PATCH] fix(netrc): review notes --- knowledge base/netrc.md | 48 +++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/knowledge base/netrc.md b/knowledge base/netrc.md index a95e8c1..4bf1cae 100644 --- a/knowledge base/netrc.md +++ b/knowledge base/netrc.md @@ -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 - +1. [TL;DR](#tldr) 1. [Format](#format) 1. [Further readings](#further-readings) +## TL;DR + +Located under a user's home directory (`~/.netrc`).
+It **must** be owned by either the user executing the command, or by the `root` user.
+ +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_.
+ 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.
+ 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.
+ 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]