From 5b13777e6d03665d857342c47489e63a67e01f48 Mon Sep 17 00:00:00 2001 From: Guillermo Ramos Date: Thu, 13 Apr 2023 10:16:11 +0200 Subject: ssf: configure remote user --- ssf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ssf b/ssf index f87cd09..2366b29 100755 --- a/ssf +++ b/ssf @@ -15,6 +15,8 @@ use warnings; my @hosts; my %aliases; +my $remote_user = $ENV{SSF_REMOTE_USER} || $ENV{USER}; + open(my $ssh_config, '<', "$ENV{HOME}/.ssh/config") or die "nope"; while (my $line = <$ssh_config>) { if ($line =~ /^Host ([^#\n]+)(?: # (.*))?$/) { @@ -70,9 +72,9 @@ if (exists $ENV{TMUX}) { # The window does not exist; make the connection in the current one # and it to the machine we're connecting to `tmux rename-window $hostname`; - system 'ssh', '-t', $host, "sh -c \"tmux new -As $ENV{USER}\""; + system 'ssh', '-t', $host, "sh -c \"tmux new -As $remote_user\""; `tmux rename-window '!$hostname'`; } } else { - exec 'ssh', '-t', $host, "sh -c \"tmux new -As $ENV{USER}\""; + exec 'ssh', '-t', $host, "sh -c \"tmux new -As $remote_user\""; } -- cgit v1.2.3