简体   繁体   中英

Emacs with Tramp mode

After doing TONS of research on every stack overflow question there is and every page that google pulls up on the subject, I am unable to get sudo to work in Emacs with Tramp mode. (Yes, I have read all the 'duplicate' questions here on stack overflow and none of the solutions work for me.)

Using Emacs 24.5.1 with the following configuration.

(use-package tramp
    :config (progn (setq tramp-default-proxies-alist (quote ((".*" "\'root\'" "/ssh:%h:"))))
              (require 'tramp)
              (tramp-mode 1)))

When I try:

/ssh:user@hostname.com|sudo:hostname

or:

/sudo:hostname.com

and many, many other combinations . . .

. . . the minute I type the colon after 'sudo' in any syntax configuration it immediately throws an error stating that sudo can only be used locally.

BONUS QUESTION: can I use Tramp to first log into a remote server as myself and sudo to another generic sudo userid there after? Like ssh:my_userid@remote_host.com|sudo:generic_userid@remost_host.com:/path/to/file

Any help appreciated.

Forget setting tramp-default-proxies-alist for the time being. Just open Cx Cf /ssh:user@hostname.com|sudo:hostname.com: . I also don't understand what setting tramp-mode shall be good for.

BONUS ANSWER: yes. Your example needs a leading / , 'tho.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM