CyberDuckという有名なクラウドストレージクライアントがあります。最近見たところ duck.sh なるツールが登場していたので試してみました。

今回はMacで実施したので

sudo brew install duck

で導入が出来る。

色々接続ができるがニーズがないであろうが SoftLayer のObject Storage (OpenStack Swift) に接続をしてみます。

$ duck --help
Usage:duck [options...]


URLs must be fully qualified. Paths can either denote a remote file (ftps://user@example.net/resource) or folder (ftps://user@example.net/directory/) with a trailing slash. You can reference files
relative to your home directory with /~ (ftps://user@example.net/~/).
Supported protocols
ftp	FTP (File Transfer Protocol)
	ftp://<hostname>/<folder>/<file>
ftps	FTP-SSL (Explicit AUTH TLS)
	ftps://<hostname>/<folder>/<file>
sftp	SFTP (SSH File Transfer Protocol)
	sftp://<hostname>/<folder>/<file>
dav	WebDAV (Web-based Distributed Authoring and Versioning)
	dav://<hostname>/<folder>/<file>
davs	WebDAV (HTTP/SSL)
	davs://<hostname>/<folder>/<file>
swift	Swift (OpenStack Object Storage)
	swift://<container>/<key>
s3	S3 (Amazon Simple Storage Service)
	s3://<container>/<key>
gs	Google Cloud Storage
	gs://<container>/<key>
azure	Windows Azure Storage
	azure://<container>/<key>
rackspace	Rackspace Cloud Files (US)
	rackspace://<container>/<key>

You can install additional connection profiles in ~/Library/Application Support/Cyberduck/Profiles

    --application <path>                  External editor application
    --copy <url> <url>                    Copy between servers
 -d,--download <url> <[file]>             Download file or folder. Denote a folder with a trailing '/'
 -D,--delete <url>                        Delete
 -e,--existing <action>                   Transfer action for existing files
                                          Options for downloads and uploads:
                                          	Resume	Append existing files (resume)
                                          	Overwrite	Overwrite all files (overwrite)
                                          	Rename	Rename transferred files with a timestamp appended to the filename (similar)
                                          	Rename existing	Rename existing files with timestamp appended to filename (rename)
                                          	Skip	Skip transfer of files that already exist (skip)
                                          	Compare	Skip files that match size, modification date or checksum (compare)
                                          	Cancel	 (cancel)
                                          Options for synchronize:
                                          	Download	Download changed and missing files (download)
                                          	Upload	Upload changed and missing files (upload)
                                          	Mirror	Download and Upload (mirror)
                                          	Cancel	 (cancel)

    --edit <url>                          Edit file in external editor
 -h,--help                                Print this help
 -i,--identity <private key file>         Selects a file from which the identity (private key) for public key authentication is read
 -l,--list <url>                          List files in remote folder
 -L,--longlist                            Long list format with modification date and permission mask
 -p,--password <password or secret key>   Password
 -P,--preserve                            Preserve permissions and modification date for transferred files
    --parallel <connections>              Number of concurrent connections to use for transfers
 -q,--quiet                               Suppress progress messages
 -r,--retry <count>                       Retry failed connection attempts
    --region <location>                   Location of bucket or container
    --synchronize <url> <directory>       Synchronize folders
    --throttle <bytes per second>         Throttle bandwidth
 -u,--username <username or access key>   Username
    --udt                                 Use UDT protocol if applicable
    --upload <url> <file>                 Upload file or folder recursively
 -v,--verbose                             Print transcript
 -V,--version                             Show version number and quit
 -y,--assumeyes                           Assume yes for all prompts

Cyberduck is libre software licenced under the GPL. For general help about using Cyberduck, please refer to https://duck.sh/ and the wiki at http://help.duck.sh/. For bug reports or feature requests
open a ticket at https://trac.cyberduck.io/newticket?version=4.7.3.
Not registered. Purchase a donation key to support the development of this software.

プロファイルをダウンロード

ここに記載されているファイルを ~/Library/Application Support/Cyberduck/Profiles/SoftLayer_TOK02_public.cyberduckprofile に保存する。これでこのプロファイルを利用できるようになります。

今回接続する SoftLayer 側の情報として以下のようになっているとします。

  • TOK2上にObjectStorageを購入
  • tokida というContainerを作成済み
  • SoftLayer Portalからusername,passwordを取得済み
$ duck --list softlayer-tok02_public://tokida/ -u "$usernaem" -p "$password"
Login successful…
.file-segments
Dropbox
a_M00xxx_2003.nsf
a_M00xxx_2004.nsf
a_M00xxx_2005.nsf

これだけで接続ができます。duckコマンド経由で利用することで SoftLayer Object Storageの制約である5Gなども正しくマルチパートでアップロードしてくれるので非常に便利に利用できますね。

$ duck -u $username -p $password --upload softlayer-tok02_public://tokida/ hosts
Upload complete…
$ duck -u $username -p $password --delete softlayer-tok02_public://tokida/hosts
Deleting hosts…

同期もでき、download, mirror , upload が選択できる。

duck -u $username -p $password --synchronize softlayer-tok02_public://tokida/dotfiles ./
Login successful…
Choose what action to take:

 Cancel	 (cancel)
 Download	Download changed and missing files (download)
 Mirror	Download and Upload (mirror)
 Upload	Upload changed and missing files (upload)

Action [cancel, download, mirror, upload]: upload

クラウドストレージは、費用面で非常に便利だが利用については各クラウドでそれぞれ利用方法が違いコマンドラインで利用するためにも際があるので使い勝手が良いとはいえませんでしたがこの duck を経由することで利用のハードルが下がります。