zshrc file by adding this line to the end of the file: source ~/.bbedit.shell If you use sudo you'll need to add this to the root's. bbedit.shell file to your remote host and source it in your. IdentityFile ~/.ssh/id_rsa_jdoe # This is the private keyĬopy the. Host synchost # The host id can be anything as long as the local and remote match The most common method to achieve this is to generate SSH keys (with the private key on the local and remote hosts, and the public key on the intermediate host) and create an entry in your ~/.ssh/config file on the local and remote hosts specifying the intermediate host parameters like the following: The goal is to be able to connect with ssh synchost without any parameters and without entering a password. If you use sudo you'll need to make sure that the root user can also connect.
Make sure that both the local and remote host can SSH to the intermediate server without user intervention. Make sure that you have the BBEdit command line tools and the iTerm2 python runtime installed. When the file is saved and closed, the remote host then copies the file back to its original location, deleting the copy on the intermediate host. It then sends a control sequence that iTerm detects and launches the python script on the local host that opens the referenced file via SFTP on the intermediate host. The shell function provides a command on the remote host named bbedit that copies the referenced file via SFTP to an intermediate server that is reachable by both the local and remote hosts. This solution will work as long as the local and remote users have SSH access to an intermediate server where the file to be edited is stored temporarily. Other solutions for this exist, but run into problems when a restrictive firewall is in the way, or if the root user is barred from logging in remotely. This python script and shell function use iTerm2's API to open remote documents in BBEdit running on the local host.