scp shell integration not working hostname problem

828 views
Skip to first unread message

Norman Cohen

unread,
Sep 7, 2021, 2:34:48 PM9/7/21
to iterm2-discuss
Hi,

I have an iMac and a MacBook Pro set up on a local network. I can use shell integration to download or upload files via scp from the iMac to the MacBook Pro but not the other way around. scp works fine both ways using the scp command from the CLI in iTerm.

When I connect from the MacBook Pro via ssh to the iMac and try to download a file by right clicking on the file name after an ls command, the contextual menu says "Download with scp from imac". When I go from the iMac to the MacBook Pro, the contextual menu says "Download with scp from NACBookpro16.local". The error that I get is the following:

Failed to connect to imac:22. Double-check that the host name is correct.

The only difference that I am seeing is the .local part of the hostname. 

When I run hostname -f on the iMac, I get - iMac

When I run hostname -f on the notebook, I get - NACBookpro16.local

I have tried resetting my hostname and localhostname using scutil as well as from the sharing pane in System Preferences. 

I think that the issue is that iTerm is getting a hostname discrepancy due to the presence or absence of the .local suffix.

Any suggestions on how I can get the hostname from the iMac to show the .local suffix when using hostname -f? Or does anyone think there is a different problem going on?

Thanks so much for any help,


Norm



Adrian Bool

unread,
Sep 7, 2021, 2:58:33 PM9/7/21
to iterm2-...@googlegroups.com
Wild guess: could the misspelling of the host name be in the iMac’s /etc/hosts file?

Sent from my iPhone

On 7 Sep 2021, at 19:34, Norman Cohen <cohen....@gmail.com> wrote:

Hi,
--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iterm2-discuss/e48df93d-2f85-4f18-b4fc-ce930aea696dn%40googlegroups.com.

Norman Cohen MD

unread,
Sep 7, 2021, 4:02:19 PM9/7/21
to iterm2-...@googlegroups.com
The /etc/hosts file is plain vanilla:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost

I don't think that is the issue. Thanks though!

Norm

You received this message because you are subscribed to a topic in the Google Groups "iterm2-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/iterm2-discuss/oyApb2_qVwQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to iterm2-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iterm2-discuss/51D2C33E-41EE-4F8D-97C6-AC4EF6D68D2E%40logic.org.uk.

Norman Cohen

unread,
Sep 9, 2021, 12:10:07 PM9/9/21
to iterm2-discuss
I think I found the issue and seem to have the problem resolved. 

At some point, I must have used the scutil command to manually set the hostname. This can override the setting in system preferences and prevent what is set there from "sticking." In addition, I had modified my .zshrc file to include an export command (export iterm2_hostname=imac) that also contributed to discrepancies between results from  the hostname -f command and what shell integration was showing in iTerm. 

So the fix was to use scutil to reset the hostname and local hostname to the empty string and remove the export command from .zshrc. Now right clicking on files while connected via ssh allows for files to download!!

This thread from apple.stackexchange.com helped me find the fix with scutil:


Norm

Reply all
Reply to author
Forward
0 new messages