Live data from Hacker News

Show HN: Shittp – Volatile Dotfiles over SSH

github.com

71–80 of 97 posts

Re: Show HN: Shittp – Volatile Dotfiles over SSH

#71
post #2

I often need to login to colleagues' machines at work, but I find that their settings are not what I am familiar with. So I wrote an SSH wrapper in POSIX shell which tars dotfiles into a base64 string, passes it to SSH, and decodes / setups on the remote temp directory. Automatically remove when session ends. Supported: .profile, .vimrc, .bashrc, .tmux.conf, etc. This idea comes from kyrat[1]; passing files via a bas…

scp my-precious-dotfiles remote:~ trap 'ssh remote rm my-precious-dotfiles' EXIT ssh remote Or you can even bake the trap into the remote bash's invocation, although that'd be a bit harder.

That overwrites the remote dotfiles. Any workarounds?

Re: Show HN: Shittp – Volatile Dotfiles over SSH

#72
post #29

Earlier quoted context omitted.

Ok, but what if your colleague does not have Vim installed? Wouldn't it make more sense to have a tool that brings files over to the local computer, starts Vim on them, and then copies them back?

I can’t recall encountering a system in the last 15 years that didn’t have vim (or at least vi for esoteric things) on it.

Would not be uncommon in a container or purpose-built VM.

Re: Show HN: Shittp – Volatile Dotfiles over SSH

#73
post #2

I often need to login to colleagues' machines at work, but I find that their settings are not what I am familiar with. So I wrote an SSH wrapper in POSIX shell which tars dotfiles into a base64 string, passes it to SSH, and decodes / setups on the remote temp directory. Automatically remove when session ends. Supported: .profile, .vimrc, .bashrc, .tmux.conf, etc. This idea comes from kyrat[1]; passing files via a bas…

How much time does it add when running e.g. "shittp user@lan-host uname" ?

Re: Show HN: Shittp – Volatile Dotfiles over SSH

#74
I have been doing something similar for years, especially for login to VMs: sets up an environment of my dotfiles based on a checkout and runs a resumable 'screen' session with tmux. This looks elegant (ephemeral), but I seldom log in to a machine I can't leave my files on as installed.

${HOME} is where your dotfiles are.

Re: Show HN: Shittp – Volatile Dotfiles over SSH

#76

Earlier quoted context omitted.

scp my-precious-dotfiles remote:~ trap 'ssh remote rm my-precious-dotfiles' EXIT ssh remote Or you can even bake the trap into the remote bash's invocation, although that'd be a bit harder.

That overwrites the remote dotfiles. Any workarounds?

GNU Stow? https://systemcrafters.net/managing-your-dotfiles/using-gnu-...

Keep the alternate sets in different subdirectories.

Re: Show HN: Shittp – Volatile Dotfiles over SSH

#77

Earlier quoted context omitted.

scp my-precious-dotfiles remote:~ trap 'ssh remote rm my-precious-dotfiles' EXIT ssh remote Or you can even bake the trap into the remote bash's invocation, although that'd be a bit harder.

That overwrites the remote dotfiles. Any workarounds?

I've found lnk [0] to be a nice tool for this. Similar to GNU Stow as another comment mentioned, but plays a bit nicer with git (and, in my opinion, is nicer to use).

Edit: just remembered there was a good comparison of lnk and stow on the HN discussion of lnk from a few months back [1].

[0] https://github.com/yarlson/lnk

[1] https://news.ycombinator.com/item?id=44080514

Re: Show HN: Shittp – Volatile Dotfiles over SSH

#78
post #2

I often need to login to colleagues' machines at work, but I find that their settings are not what I am familiar with. So I wrote an SSH wrapper in POSIX shell which tars dotfiles into a base64 string, passes it to SSH, and decodes / setups on the remote temp directory. Automatically remove when session ends. Supported: .profile, .vimrc, .bashrc, .tmux.conf, etc. This idea comes from kyrat[1]; passing files via a bas…

> I often need to login to colleagues' machines at work, but I find that their settings are not what I am familiar with

I'd hate to jump to conclusions, but what username are you looking into what machines with for that to be an issue?

Re: Show HN: Shittp – Volatile Dotfiles over SSH

#79
post #4

tmp="$(mktemp -d)" && rsync -a --exclude='.ssh' user@host:~/.[!.]* "$tmp"/ && HOME="$tmp" exec "$SHELL"

I do the same, but I skip rsync for git.

    git clone $uri dotfiles; export HOME=$(pwd)/dotfiles 
These days, my laptop acts as a dumb SSH gateway for Linux VMs. No configuration or setup, aside from VS code connecting to VMs. Any server that I would want to load my dotfiles onto will almost always have git installed.

Rant (not directed at any comment here): If it's a production server without git, then please do not run scripts like this. Do not create junk directories on (or ideally any modifications to) secure machines. It inevitably causes new and uninteresting puzzles for your colleagues. Create documented workflows for incident responses or inspection.

Re: Show HN: Shittp – Volatile Dotfiles over SSH

#80
post #29

Earlier quoted context omitted.

Ok, but what if your colleague does not have Vim installed? Wouldn't it make more sense to have a tool that brings files over to the local computer, starts Vim on them, and then copies them back?

I can’t recall encountering a system in the last 15 years that didn’t have vim (or at least vi for esoteric things) on it.

While not mandatory, vi is part of the POSIX commands. I mean you could use ed or even hack your way with awk, sed, and/or grep but no one wants to deal with that bullshit. And if you're installing vi you might as well install vim, right?

I've been on a lot of systems and can't remember a single instance of not having vi (though I do vim). So pretty rare, like you said

https://en.wikipedia.org/wiki/List_of_POSIX_commands

Post reply on HN