AngeFtp allows you to access remote files via ftp – transparently. Essentially: “magically”. All you need to do is remember the weird file name syntax: Instead of C-x C-f dir/file you use C-x C-f /user@host:dir/file to open the file.
A bigger version is available: C-x C-f /protocol:user@host#port:dir/file in case of your ftp server does not use a standard port. When
‘host’ doesn’t begin with
‘ftp’, emacs may choose other access method by default (depends on variable tramp-default-method-alist), use
‘protocol’ here to tell emacs the expected access method is ftp.
There is also a mini version C-x C-f /host:file
Prerequisites: You must have a command-line ftp client installed that can be used by Emacs in a sub-process. The ftp client distributed with Windows, for example, is no good. (does it know FTP at all????)
If you cannot use FTP because it is considered a security hazard, you might try TrampMode. TRAMP will work using other clients than just FTP clients.
Note: I’ve seen tramp.el silent corrupt files, and have heard reports of this from other people too (yes, I’ve filed a bug report). – Doom
My approach is to use a SSH “tunnel”; do something like:
ssh -f -N -L 21:remote.host:21 email@example.com
as root (non-privileged ports don’t require root access; do something like “…2021:remote.host:21…” as joe user). Either way, you’ll be prompted for a password, after which SSH will drop into the background. Now aim AngeFtp at “localhost” and let loose. --BrianBerry
There’s a perl script (written by Russell Standish) that can handle this for you: http://cpan.org/authors/id/R/RK/RKS/ange-ftp-over-ssh.1.1-script.pl (it was formerly called “nftp.pl”).
In addition to having greater reliability than tramp.el, this is also subjectively faster (it uses a background process).
This script formerly known as nftp works very well, except for two problems:
Does anyone else have these problems, or a solution to them? – AlexMidgley
I don’t know about a solution, but AngeFTPOverSSH? has its own SourceForge? project. I have largely abandoned AngeFTPOverSSH? maintenance as I don’t tend to need it these days (I use VNC or RDP solutions instead), and the code morphed so much by other contributers, it would take me a long time to understand it again.
The FTP servers on some UNIX machines have problems if the ‘ls’ command is used. ange-ftp is unable to automatically recognize dumb unix hosts. Set
‘ange-ftp-dumb-unix-host-regexp’ to a regexp matching dumb hosts.
Here is the one I use:
(setq ange-ftp-dumb-unix-host-regexp "ftp\\.geocities\\.com")
If you know of more well-known hosts, edit this page and add them to the list:
(setq ange-ftp-dumb-unix-host-regexp (regexp-opt '("ftp.geocities.com" "...")))
Some Windows hosts have a MSDOS-like directory style by default, the typical signal is autocompletion not working and Ange-Ftp not being able to find any file. A (hackish) workaround I found is:
(defvar ange-ftp-windows-hosts '("184.108.40.206") "List of hosts running a Windows FTP server" )
(defun ange-ftp-msdos-dirstyle-off () "Toggles the dirstyle of the host if listed in the `ange-ftp-windows-hosts' variable. This function is intended to be called from inside the hook `ange-ftp-process-startup-hook'" (if (member host ange-ftp-windows-hosts) (let* ((result (ange-ftp-send-cmd host user '(quote "site dirstyle"))) (line (cdr result)) (ok (car result)) (msdos (string-match "200 .+off" line)) ) (if ok (if msdos (ange-ftp-send-cmd host user '(quote "site dirstyle") "Host declared to be running Windows, turning off MSDOS dirstyle") (message "Host declared to be running Windows, and MSDOS dirstyle already off.")) (message "Host declared to be running Windows, but didn't accept DIRSTYLE command.") ) ))) (add-hook 'ange-ftp-process-startup-hook 'ange-ftp-msdos-dirstyle-off)
A better solution would be including support for Windows hosts in Ange-Ftp (possibly autodetecting it in
‘ange-ftp-guess-host-type’ using the “system” ftp command), and then check for MSDOS listing style being off somewhere else.
I had to invert the
‘msdos’ condition in the above hook, because sending the “site dirstyle” command to check which style is active actually toggles it. So if the above does not work for you, try changing it to `(if (not msdos) …’.
Put the following code in your ~/.emacs file. Modify values according to your network configuration.
(setq ange-ftp-gateway-host "proxy-server" ange-ftp-smart-gateway-port "21" ange-ftp-local-host-regexp ".*" ange-ftp-smart-gateway t)
Specify ange-ftp-gateway-host as host name of the proxy server, ange-ftp-smart-gateway-port as port number of the proxy server. Set host name regexp you want to access directly, not to access over proxy, to ange-ftp-local-host-regexp.
If you are behind a firewall, perhaps you are having problems using AngeFtp (or indeed any active-mode ftp client). http://mail.gnu.org/pipermail/help-gnu-emacs/2001-April/006468.html has some ideas for what to try, although some tweaks to the code may be necessary.
If your ftp client supports passive mode, you may be able to use it in this mode via the variables ange-ftp-ftp-program-name and ange-ftp-ftp-program-args. For example, on Linux if ftp is invoked as “pftp”, it automatically uses passive mode. So this works on my system: (setq ange-ftp-ftp-program-name “pftp”). This is not as elegant a solution perhaps as it forces passive mode at all times, but it is simple.
; Tweaked by eraatikidotfi based on code from ; http://mail.gnu.org/pipermail/help-gnu-emacs/2001-April/006468.html: ;; From: Ehud Karni ehudatunixdotsimonwieseldotcodotil ;; Date: Wed, 18 Apr 2001 19:45:08 +0300 ;; Subject: Ange-ftp: passive mode transfers?
(defvar ange-ftp-hosts-no-pasv '("localhost") "*List of hosts that do not need PASV (e.g. hosts within your firewall). Used by `ange-ftp-set-passive'.") ; rephrased, added "*" // era
(defun ange-ftp-set-passive () "Function to send a PASV command to hosts not named in the variable `ange-ft-hosts-no-pasv'. Intended to be called from the hook variable `ange-ftp-process-startup-hook'." ; rephrased significantly // era (if (not (member host ange-ftp-hosts-no-pasv)) (ange-ftp-raw-send-cmd proc "passive")))
(add-hook 'ange-ftp-process-startup-hook 'ange-ftp-set-passive)
There is now a much simpler and less error-prone way to enable passive mode: M-x customize-option ange-ftp-try-passive-mode to t (from its default value, nil).
The “ftp for win32” below seems to be passive by default. (Enter ftp and try help passive and passive).
The MIT Kerberos FTP client outputs some extra messages and uses different login success codes, which take Ange FTP by surprise. Modify these values to make it work:
(setq ange-ftp-ftp-program-name "kftp" ; Probably only required for some installations ange-ftp-skip-msgs (concat ange-ftp-skip-msgs "\\|^334 Using authentication\\|^GSSAPI" "\\|^530-There is a problem with your ftp client" "\\|^530 Enable encryption before logging in") ange-ftp-good-msgs (concat ange-ftp-good-msgs "\\|^232 "))
See http://www.xemacs.org/Documentation/packages/html/efs_2.html for EFS Documentation.
There is a version of Ange FTP here that supports Tandem/Guardian/NSK systems.
Under Win32, you need a decent FTP client to enable ange-ftp. Download one at ftp://ftp.gnu.org/old-gnu/emacs/windows/contrib/ftp-for-win32.zip for instance. Then, just configure the ange-ftp-ftp-program-name variable to reference this ftp.exe program.
Use customize or add the following to your .emacs:
(setq ange-ftp-ftp-program-name "c:/programs/ftp.exe")
or if you installed the EmacsW32 version, it comes with the gnu ftp client already, simply set
(setq ange-ftp-ftp-program-name "C:/Program Files/Emacs/EmacsW32/gnuwin32/bin/ftp.exe")