cuspymd / tramp-term.el

Provides a quick way to create an ansi-term containing an ssh session with remote directory tracking already configured.
43 stars 12 forks source link

Configuring non standard port? #1

Closed ghost closed 9 years ago

ghost commented 9 years ago

How do I go about configuring a non standard ssh port, or have tramp-term read ~/.ssh/config?

randymorris commented 9 years ago

Configuring the port in ~/.ssh/config should work fine. All tramp-term does is call "ssh host" so if running that from the command line directly works with the custom port then tramp-term should work. I'll test when I can get to a computer.

randymorris commented 9 years ago

I just confirmed this by adding the following to my ~/.ssh/config:

host test
    hostname myhost
    user myuser
    port 5046

Then ensured an ssh daemon was running on myhost on port 5046. I ran M-x tramp-term and entered test when prompted and it connected as expected.

ghost commented 9 years ago

Thank you. For some reason my .ssh/config was not readable (symlinked from dotfiles repo). Now I'm able to login (also for a passowrd-less login, as expected), though I'm seeing some errors:

user@somehostname:~$ function set-eterm-dir {
>     echo -e "\033AnSiTu" "$USER"
>     echo -e "\033AnSiTc" "$PWD"
>     echo -e "\033AnSiTh" "somehostname"
>     history -a
> }
user@somehostname:~$ PROMPT_COMMAND=set-eterm-dir
user@somehostname:~$ clear
'eterm-color': unknown terminal type.

Under ~/.terminfo/e I have

--- ~ » ls ~/.terminfo/e 
README         eterm-color    eterm-color.ti
randymorris commented 9 years ago

The terminfo files need to exist on the remote machine for that to work. The only time I've had that problem was when emacs wasn't installed on the remote. I worked around it by adding the hook function that allowed me to just use TERM=xterm. I'm not sure what repercussions that has but I never had an issue. Here's an example:

(add-hook 'tramp-term-after-initialized-hook
          (lambda (host)
            (cond ((equal host "testhost")
                   (term-send-raw-string (concat "export TERM=xterm; clear" (kbd "RET")))))))
ghost commented 9 years ago

of course, silly me :(