diff options
author | Guillermo Ramos | 2023-04-13 10:16:11 +0200 |
---|---|---|
committer | Guillermo Ramos | 2023-04-13 10:16:11 +0200 |
commit | 5b13777e6d03665d857342c47489e63a67e01f48 (patch) | |
tree | d0d61cd40a52636fce5e3cdb1c25f39149761b74 /ssf | |
parent | 67f87965bb5cc77d1025d9db60ac86fac2f9b169 (diff) | |
download | cli-5b13777e6d03665d857342c47489e63a67e01f48.tar.gz |
ssf: configure remote user
Diffstat (limited to 'ssf')
-rwxr-xr-x | ssf | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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\""; } |