NETRC(5)

πŸ’– NETRC(5) β€” the file formats manual page, but make it cute πŸ’–

okay bestie so this is NETRC(5), straight out of the File Formats Manual, and it's literally the glow-up guide for your ftp autologin era. no cap. ✨


🌸 NAME 🌸

netrc β€” user configuration for ftp πŸ¦‹


✨ SYNOPSIS ✨

~/.netrc

that's it. that's the whole vibe. one lil hidden file in your home directory. iconic. πŸ‘‘


πŸŽ€ DESCRIPTION πŸŽ€

so this file is where you keep your configuration and autologin info for the File Transfer Protocol client ftp(1). it's giving "let me log in without typing my whole life out every single time." πŸ’…

the .netrc file holds the login and initialization info that the auto-login process uses. it lives in the user's home directory. here are the tokens it recognizes β€” and bestie, they can be separated by spaces, tabs, or new-lines, so go off with the formatting fr fr:

  • machine name β€” identifies a remote machine name. the auto-login process searches the .netrc file for a machine token that matches the remote machine you specified on the ftp command line or as an open command argument. once a match is made, the subsequent .netrc tokens get processed, and it stops when it hits the end of file or runs into another machine token or a default token. so orderly. so demure. 🧚
  • default β€” this is the same as machine name except that default matches any name. there can be only one default token, and it must come after all the machine tokens. no queue-jumping allowed. it's normally used like this:
default login anonymous password user@site

which gives you automatic anonymous ftp login to machines that aren't listed in .netrc. and if you want to be like "not today," you can override all of it by using the -n flag to disable auto-login. πŸ’€

  • login name β€” identifies a user on the remote machine. if this token is present, the auto-login process will initiate a login using the specified name. main character entrance, honestly. ⭐
  • password string β€” supplies a password. if this token is present, the auto-login process will supply the specified string when the remote server requires a password as part of the login process.
🚨 okay important warning time: if this token is present in the .netrc file for any user other than anonymous, ftp will abort the auto-login process if the .netrc is readable by anyone besides the user. so lock that file down, bestie. permissions are not a suggestion. πŸ”₯
  • account string β€” supplies an additional account password. if this token is present, the auto-login process will supply the specified string if the remote server requires an additional account password, or the auto-login process will initiate an ACCT command if it doesn't. versatile queen. πŸ’œ
  • macdef name β€” defines a macro. this token functions just like the ftp macdef command functions. a macro gets defined with the specified name; its contents begin with the next .netrc line and continue until a null line (that's consecutive new-line characters, not one) is encountered. and if you define a macro named init, it is automatically executed as the last step in the auto-login process. surprise bonus feature, we love her. πŸŽ€

πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole page, bestie β€” no skips, no summaries, every token accounted for. mwah. 🫢

this lil cutie came from Linux NetKit (0.17) and was dated September 23, 1997 β€” vintage but still slaying, honestly. πŸŒˆβœ¨πŸ’–