Modetc: Move your dotfiles from kernel space

https://news.ycombinator.com/rss Hits: 3
Summary

modetc Move your dotfiles from kernel space modetc is a Linux kernel module that rewrites paths in file operations: it allows you to move files wherever you like, while still having programs finding them where they expected them to be. The main application is to move the dotfiles of those stubborn programs that refuse to adopt the XDG basedir standard, away from the home directory. For example, you can rewrite the path ~/.ssh to ~/var/lib/ssh. Yes, this is the nuclear option. Configuration modetc is configured via module parameters that are set either when manually loading the module (eg. modprobe modetc homedir=...) or by adding a line to /etc/modprobe.conf. The parameters are: Name Default value Description homedir N/A Home directory where to rewrite paths default_rule N/A The default replacement for all dotfiles rules_file /etc/modetc.conf File containing the rewriting rules debug 0 Turn on debugging for rewriting rules Rewriting rules modetc rules are pure text search and replace: single substitution per file path, no wildcards nor regular expresssions. The rules are only applied to absolute path with the homedir prefix followed by ., or to any relative path with a leading . when the working directory is homedir. Rules are tested in the order in which they appear in the rules file and the first to match will be applied. If no specific rule matches, the leading . of the file path will be replaced with the value of default_rule. The rules file consists of one or more lines with one rule per line of the following format Note: whitespace is significant and match and replacement are separate by a tab character. On a given line, anything after a # character is treated as a comment. Empty lines are also ignored. Note: the maximum number of rules supported is 16. Example rules file: Runtime commands You can send modetc some commands like reloading the rules file or pausing the rewriting by writing them to /proc/modetc. For example Use cat /proc/modetc to get a list of c...

First seen: 2026-01-24 10:51

Last seen: 2026-01-24 12:51