FTP

Return to Home / You can see this page in English , 简体中文 , 正體中文 or 日本語 .

Runftp Runftp

Runftp は, Android で動く FTP/FTPS/SFTP クライアントです. FTP はファイル転送プロトコルの略で, これを使えばどんな UNIX サーバとも, テキスト, 写真, 音楽, ビデオ, その他のファイルを交換することができます.

Android Market から Runftp か, 私の名前 Lewske で検索してダウンロードすることができますし, Apps - Communication - Runftp にも配置されています.

VersionImprovement
1.3.0 ローカリゼーションの為に文字列を分離しました. SFTP 秘密鍵ファイルをブラウズして選択できます.
1.2.9 ファイラのスクローラが追加されました.
1.2.8 接続の管理が改善されました.
1.2.7 データベースの新規作成のバグの修正.
1.2.6 小さな UI の変更.
1.2.5 SFTP 公開鍵のサポートを追加.

はじめに

Runftp には多くの機能があり, ここでは一般的な使い方を先に説明します.

最初に, FTP クライアントは, 世界のどこかにある FTP サーバに接続しなければなりません. 個人ホームページやウェブホスティングのようなサービスを提供されたら, ほとんどの場合に FTP サーバの権利が与えられます. 詳細はシステムアドミニストレータに相談してみるといいでしょう.

一般的な利用

初めて使うときは, 右側のリモートファイルビューに置かれている簡易接続ユーザインタフェイス をクリックして, どこでも好きなところに接続することができます. デフォルトで表示されている窓は, ローカルファイルビューと呼ばれます. 右側に見えるサイドバーを指でスライドさせて, リモートファイルビューへとスクロールできます.

Local File View < ファイラビューの切り替えのためのスクロール > Remote File View

リモートファイルビューで, 新たにサイトを開く をクリックし, 好きな URL を入力するか, ヒストリのいくつかを覚えているリストから選びます.

URL の一般的な書式は :

scheme:username@host.domain:port

であり, schemeftps, ftp or sftp のいずれか, username, host.domain は文字通りを意味し, port は TCP ポート, 例えば SFTP 用の 22 になります. (21 はデフォルトで FTP で, これにしたい場合は port を省略できます.)

SFTP のための DSA 秘密鍵を与える事もできます. ( DSA 鍵だけが受け入れられます. RSA 鍵を誤って使用しないでください. )

一度接続されると, ファイルをタッチして, コピーまたは削除したり, あるいはロングタッチ (ファイルをタッチしたまま 1 秒間押し続けます) して, すべてのマークされたファイルをコピーまたは削除するバッチプロセスを 起動することができます. ファイルをマークするには, 項目をタッチして, その指をどこか他のところへ 移動してください. マークされた項目は通常ハイライトされています.

コンソールの利用

あなたが少し変わっていてコンソールを使いたいなら, open またはその略 o コマンドで, 接続を開始する必要があります.

FTP および FTPS には

$ o username@blahblah.com

とタイプしてください. もしくは例えば SFTP 公開鍵認証には, 事前に秘密鍵を準備しておき (/sdcard/id_dsa としましょう),

$ o -i /sdcard/id_dsa sftp:username@blahblah.com

とタイプしてください. ( 先にも書いたように, DSA 鍵しか利用できません. )

そうしたら, 対象の FTP ホスト名と $ 記号でプロンプトされた後に,

user <あなたのユーザ名>

を, 続いて指定されているパスワードをもう一度入れます. 上で既にユーザ名を与えたのであれば, これは場合に当てはまりません.

FTP$ open ftp.hogehoge.net
Connected to ftp.hogehoge.net
220 Welcome to hogehoge FTP server.
....
ftp.hogehoge.net$ user alibaba
331 Enter your password
Password:opensesame
230

FTPS は, いつでも使用可能なときにオンになります. しかしながら, open とホスト名の間に ftps: そして username@ を挿入することで, 安全な (SSL の) 接続を明示的に有効にできます :

FTP$ open ftps:run.sh

SFTP (SSH FTP) 接続を有効にするには, sftp:username@open とホスト名の間に挿入します :

FTP$ open sftp:ryu@run.sh

リモートディレクトリのファイルを一覧表示するには, 単に ls とタイプします.

ftp.hogehoge.net$ ls
227 Entering Passive Mode (203,216,247,246,139,157)
150  Opening ASCII mode data connection for  .
total 256
-rw-rw-r-- 1 53 53 442841 Jan 1 22:06 2009-10-29_16.18.32.jpg
-rw-rw-r-- 1 53 53 673902 Dec 29 08:03 2009-12-11_07.54.21.jpg
-rw-rw-r-- 1 53 53 398775 Jan 1 22:09 2009-12-30_13.55.25.jpg

リモートディレクトリは昔懐かしい DOS と同様に cd コマンドで変更できます.

デフォルトのローカルディレクトリは /sdcard/dcim/Camera です. lcd <対象ディレクトリ> とタイプすれば, これを変更できます.

ftp.hogehoge.net$ lcd ../..

この例は, カレントディレクトリを親のさらに上のディレクトリ, すなわち /sdcard に移動します.

電話機のカレントディレクトリにある File_Name と名付けられたファイルを ダウンロードするには, 次のようにタイプします :

ftp.hogehoge.net$ get ファイル名

電話機のカレントディレクトリにある File_Name と名付けられたファイルを アップロードするには, 次のようにタイプします :

ftp.hogehoge.net$ put ファイル名

そのディレクトリにあるすべてのファイルを電話機にダウンロードするには, mget * とタイプします.

ftp.hogehoge.net$ mget *

電話機の lcd で指定したディレクトリに存在するファイルをすべてアップロードするには, mput * とタイプします.

ftp.hogehoge.net$ mput *

おしまい

これで, あなたは Runftp の基本的な操作を行えるようになったはずです.

おめでとう!

このページの残りは FTP サーバやプログラムを組むためのヒントとなる付録にすぎません.

ProFTPD

ProFTPD is a highly configurable FTP server. Supports FTPS (FTP over SSL/TLS).

To configure, edit the file /etc/proftpd/proftpd.conf.

Remove any pounds at first column in <Anonymous ~ftp> section so that you enable anonymous logins.

  # Restrict anonymous uploads to only 10 megabytes
  MaxStoreFileSize 10 Mb user anonymous
  MaxStoreFileSize *

If you are going to manage a popular site which calls the process many times, you may set the ServerType to standalone instead of inetd.

  ServerType standalone

If you go standalone, you need to also disable ftp process startup in /etc/inetd.conf.

#ftp ....

First SIGHUP xinetd, then proftpd.

$ sudo /etc/init.d/xinetd restart
$ sudo /etc/init.d/proftpd restart

When you create an SSL certificate for an authority e.g. CAcert , you need to copy the CA.pl script contained in openssl package to /etc/ssl and execute it with -newreq :

$ cd /etc/ssl/
$ sudo cp /usr/lib/ssl/misc/CA.pl .
$ sudo ./CA.pl -newreq

Provide your host name as the common name that's questioned in the program.

Common Name (eg, YOUR name) []:run.sh

To enable SSL/TLS connection, uncomment the tls.conf inclusion in /etc/proftpd/proftpd.conf :

Include /etc/proftpd/tls.conf

and edit /etc/proftpd/tls.conf this way.

<IfModule mod_tls.c>
  TLSEngine on
  TLSLog /var/log/proftpd/tls.log
  TLSProtocol SSLv23
  TLSRSACertificateFile /etc/ssl/certs/hoge.crt
  TLSRSACertificateKeyFile /etc/ssl/private/hoge.key
  TLSVerifyClient off
  TLSRequired off
</IfModule>

FTPS (FTP over SSL/TLS)

Using TLS 1.0 is currently the best approach. You probably want to disable old SSL 2.0 support in the client that may confuse the handshaking.

Authentication and Authorization

AUTH TLS
234
USER xxxx
TLS/SSL connection established.
331 Anonymous login ok, send your complete email address as your password
PASS xxxx
230 Anonymous access granted, restrictions apply
OPTS UTF8 ON
200 UTF8 set to on
SYST
----
FEAT
----

Storing and Retrieving Files

PBSZ 0
200 PBSZ 0 successful
PROT P
200 Protection set to Private
TYPE I
200 Type set to I
PASV
227 Entering Passive Mode
STOR/RETR hoge.tar.gz
150 Opening BINARY mode data connection for hoge.tar.gz
226 Transfer complete

Listing Files

PBSZ 0
200
PROT C
200
PASV
227 Entering Passive Mode
LIST/NLST
150 Opening ASCII mode data connection for file list
226 Transfer complete

SFTP (SSH FTP)

SFTP is not compatible with traditional FTP at all. It just utilizes the transfer function subsystem sftp-server of sshd in OpenSSH.

Generally SFTP packets cannot pass through proxies either.

RFCs For Reference

Have fun.

E-mail : ryu@run.sh
Valid XHTML 1.0 Strict Level A conformance,
  W3C WAI Web Content Accessibility Guidelines 2.0
Return to Home