Hacker News new | past | comments | ask | show | jobs | submit login
SSH-tools: Making SSH more convenient (github.com/vaporup)
138 points by vaporup on Feb 14, 2022 | hide | past | favorite | 35 comments



One thing I wish ssh would make easier is terminfo. I have moved from using xterm as my daily terminal emulator to kitty. The only complaint I have is when I ssh around, I need to copy the terminfo to the remote system (kitty does not use TERM="xterm-256color" because it is not 100% compatible).

Kitty does have a ssh wrapper which can copy the terminfo for me, but I rarely remember to use it. And it doesn't work for every scenario. Honestly, I wish that it was more common / feasible to probe terminals for capabilities instead of relying on an env var & terminfo files.

So while I wait for the kitty terminfo to be in the database by default on most systems, I often override TERM to xterm-256color.


Because of my experience with Kitty I agree this is a little bit of a pain point which could use some TLC by all parties involved. However, kitty seems to occupy a unique position on this and although it has intriguing ideas does not seem to have many tools needing the same accommodations. Iterm and wezterm both just use xterm-256color perhaps because there’s no better options. I just tested the setEnv ssh_config option others mentioned and that seems a good workaround. It is a bit confusing to have to set that but doing so avoids overriding the kitty.conf setting which is very strongly discouraged. It would be ideal to only set that when using kitty to make an ssh connection but since all my other tools use it anyway it isn’t a major issue.

I think my biggest pain points with SSH are more related to sessions and tools. I can easily navigate to servers but it’s a bit of a pain when I have to use certain users to log in and then others to operate on data on those servers. VSCode has good ssh support if you are able to log in as the same user as the user that has edit permissions on the files you need to modify. Wezterm ssh and iTerm tmux integration have also given me trouble when I want to open a new pane after I’ve run su or sudo. I end up having to use workarounds like changing permissions while I edit and changing back or simply avoiding the feature altogether because I’m already on the server and didn’t remember to connect with the right command or didn’t start tmux before I started work.


Modern ssh clients support adding a "SetEnv" in .ssh/config, might work for overriding TERM as well


I solved this issue by adding

    alias ssh='TERM=xterm-256color ssh'
To my .bashrc/.zshrc


Also kitty user here, and one thing I really missed about xterm is the ability to "InhibitTite" to disable the second buffer. Use case: I edit a documentation file, find a set of commands I need to run, and exit the editor to run them, and the commands disappear from my screen. xterm has a few options allowing you, as the user, to disable this functionality and just have a single screen.

Most other terminals do not have this option.

So for kitty, I made a small deb package with the kitty terminfo file, which I need anyway unless I use xterm-256color, but I modified the entry to not have the ti/te entries.

Win/win.


Fellow Kitty user here, similar hurdles.

If you haven't implemented it in your workflow already, you can conditionally set TERM for hosts in your SSH configs with SetEnv.

This is one of the few, if not the only, variable that SSHd will allow clients to set for free.


What does your last sentence mean? What is the "cost" for setting other vars?


There are only a few environment variables allowed to be set by an SSH client by default. You can add more by adding an "AcceptEnv" line to the SSH server "/etc/sshd_config" file.


As others have pointed out - security restriction.

The service must allow most variables to be set by connecting clients.

If TERM were included in this, you might as well install the terminfo! Fortunately that's not the case.

One could do some interesting things if say SHELL or LDPRELOAD were allowed to be forwarded.


It means it's not constrained by security concerns. Some Env are not forwarded. This one is.


I'd love to see a replacement for PuTTY. The '90 shareware vibe for handling the saved sites or for setting the password/key options ruins my mood every time I have to use it (often enough). Ironically, all the few others I saw try their best to copy its look and feel...


Royal TSX on MacOs

https://royalapps.com/ts/mac/features

Or MremoteNG (which is a wrapper around putty among other remote tools) on Windows

https://mremoteng.org/


I think mRemoteNG is my winner: multiple settings, GUI, covers even RDP... thank you!


On the latest windows , powershell comes with ssh built in. I dont use putty anymore, just open up powershell and ssh in

Even better-- get WSL, and you can get a full fledged linux system.


Main things I miss when I try switching away from putty are `alt-shift` for block selection and bracketed paste in to vim https://github.com/ConradIrwin/vim-bracketed-paste


openssh is great and id prefer to stay with it in a pure fashion.

but where im at now just has thousands upon thousands of systems.

most with super long domain names.

only about 40 machines are my direct customers that have my ssh key on. the rest rely on a password i have to obtain/provison, or ssh over ldap and the key rotates frequently.

i cant manage it in a timely fashion without a gui app that has a section to remember connections in a nested/tree fashion


Fine if all you need is one connection, but PuTTY has "bookmarks and settings management" on top of that.


You realize you can save all your connections, keys, settings (per connection) in ~/.ssh/config

Right?

https://linuxize.com/post/using-the-ssh-config-file/


Isn’t that what your SSH config will give you if setup correctly? Apart from the UI of course


Learning a little vim (i.e. how to open multiple buffers and tabbing between them) as well as learning a little tmux and a little htop has made my experience with ssh way more palatable.


+1 to learning a little bit of Vim, but I'd say buffers aren't necessary to get a passable experience. At least for casual SSH purposes.

Never been able to get the hang of tmux though. I know it's super powerful but I feel like in constantly fighting it. Though even just screen for keeping multiple console sessions alive at a time is super helpful even if I only use one at a time.


For me, getting value out of tmux required some significant overrides of the default configs, and knowing where to start was super daunting for me. From a HN post a few years back, I started installing the Noobs Term (https://noobs-term.com) defaults on any new system that I install. This suite of defaults does a lot of things, including installing nvim over vim, an opinionated zsh config with oh-my-zsh set of defaults and a quite nice tmux config, making it easy and reasonable to create new tabs and panes, swap between them and navigate around. With this, tmux quickly went from chore to pleasure to use.


I went with oh-my-tmux, and added a few plugins for copy-pasting in the buffer, and now I'm wishing I had that ability in my kitty term as well. I can hit a couple hot-keys and get quick copy/paste access to: git revisions, file paths, words, or any random start/stop letters on the screen. Using the plugins extrakto, tmux-copy-toolkit, and tmux-copycat.



That looks promising, I'll take a look, thanks! I had gone through the list of kitties but somehow didn't think that one was what I was looking for.


I recently went through a whole big tooling push where I switched from neovim with a set of configs and plugins I've been pulling along for a decade or two, to (eventually) LunarVim and mostly the stock config.

But, in screen LunarVim and kakoune and other editors I was playing with were totally jacked. So I finally made the switch to tmux and oh-my-tmux.

htop is good, but check out btop. https://github.com/aristocratos/btop


everyone should make learning ssh, screen/tmux and vim a priority.


SSH question for people.

A few years ago I learned how to suspend an ssh terminal connection (like ctrl-z for a regular app). I forgot how to do that or even how I would look it up.

Anyone know?


You’re looking for the tilde key. Hit `~?` for a help menu in-session. You may need to precede that with a fresh carriage return to make it work.


Yes! That's it. “~ ctrl-z” Thank you!


Yep! Can add extra port forwards in that menu too by resending -L or -R in that menu.

The fresh carriage return is key. Took me awhile to understand it needed to be done on an unblemished input line.

I'm pretty sure this stacks for nested ssh sessions too. ~ current session, ~~ for it's parent, and so on. I might have this reversed.


Anyone knows a way to use vault cert auth with proxycommand or something like that? To use it transparently with emacs and other tools.


Packages for many distros, some I have never heard of. But not for Fedora?


Fedora made it very difficult to get the package in and Gentoo seemed to have no interest


Looks very handy. Thanks for these tools!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: