From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id d00b6938 for ; Fri, 19 Jul 2019 17:41:27 +0000 (UTC) Received: (qmail 2296 invoked by alias); 19 Jul 2019 17:41:16 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24078 Received: (qmail 4898 invoked by uid 1010); 19 Jul 2019 17:41:16 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm1-f47.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.101.2/25510. spamassassin: 3.4.2. Clear:RC:0(209.85.128.47):SA:0(-2.0/5.0):. Processed in 2.056604 secs); 19 Jul 2019 17:41:16 -0000 X-Envelope-From: luomat@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.128.47 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=U1BnbX7TjxK/4ciODgq9EN8XG17trdl7gTHhGZVTD3I=; b=lIxh3Fn5I42q8sHh2jTv19tdUG/qxNC/kFdXYTJEqIEyHtN16IfT1cyS5eUCnHkV2g 3ZvbldXn1w1ShxNCmcgcUVZJW4J109BTmyB4QJjAbF0LQg73FH+IIQOegVuHSLprdB7E 0R8F9QbDyO60/GIB+VZccmNFdoESH3qLrB4tV4Ft9DEs+P/+BEgh74U1jKi3VG+ldsmX 8BcpgBZbVRknHpADewGhVW8Cw0eHKP7CrNbWO3AsaKTOdVabssiY7CY2KnaS37OmjtlQ RlEI20Zk13IvpYOUJnkTFqaN1yUDf3QwZO879WCTp6NugFKwxvQAQfF6c2AtECfoZWyN CV+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=U1BnbX7TjxK/4ciODgq9EN8XG17trdl7gTHhGZVTD3I=; b=gQtv7W1YXyRCOuUX9i0gdF9YwhqtBYrrjWqQTZX+uwnwdnf0S20iH0sVhVKlNFpD+h KyoT0HjFgOdeI0WaJftyDzFx8uAB7BE1d3k/6cVGHjW+h4hJK7X8LZ9QzP1Ws849adZD LxRqFV+NKmzTJhm6zXr9rd5+xWtixqLoHVr4ISwyvlxhYpGRtgpYgYyWzreZi5sAU2Gs xp87Ibms3RrhzzrqoDQAw00dVpuH4Q12fzXGa6UPRkGwOkniC3A94PnmQ6Kvm3+lqcJi 35BAxFNEZ+FElIm/LlYP0EH1WWM7InvrxYBlEIuah9xu9DrJ/Fc4g6i1D0LGKJjy5G7E SVHQ== X-Gm-Message-State: APjAAAUWzYC9cYzbKPXN0cTOvt8xy9TTJGiC7zQgXPLckiPBcO5KnomB PCrJkjT/rwbJJLkZ8gcK0+D+3AxeaphzftquygY9GPMkDAk= X-Google-Smtp-Source: APXvYqxQDw3N7KsnHyzJ78Q0XqIEYddQRo0XECpMb2fOq0XtElfKPRMR7lLK4gvHJNm9NFm1YgOrm2+kvtjjyK/ydZs= X-Received: by 2002:a1c:720e:: with SMTP id n14mr48976196wmc.53.1563558038339; Fri, 19 Jul 2019 10:40:38 -0700 (PDT) MIME-Version: 1.0 From: TJ Luoma Date: Fri, 19 Jul 2019 13:40:02 -0400 Message-ID: Subject: ssh and chdir to my PWD on the local computer To: Zsh MailingList Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I wanted to be able to ssh to another computer and immediately chdir to the same directory that I was using locally. I came up with _a_ solution, but I'm not sure if it's a good one, or if there would be other ways to do this more easily/better, so I'm sharing it here. Since all of the computers are under my own control, I was able to accomplish this by editing the ssh_config and sshd_config files to add `SendEnv CWD` and `AcceptEnv CWD` respectively. /etc/ssh/ssh_config: SendEnv CWD /etc/ssh/sshd_config: AcceptEnv CWD I also added this to the end of my .zshrc file: if [[ "$CWD" !=3D "" ]] then echo "changing to '$CWD'" cd "$CWD" fi Then I was able to use this by connecting to my remote computer like this: CWD=3D$PWD ssh remote.host.tld The last part seems a little clunky, although I'm sure I could make a function or something, but I wondered if anyone else has solved this a different way, and if so, how=E2=80=A6 or does anyone have a suggestion how= to do this differently / better? Thanks for your time Tj -- TJ Luoma TJ @ MacStories Personal Website: luo.ma (aka RhymesWithDiploma.com) Twitter: @tjluoma