.netrc ファイルによるFTP自動ログイン
UNIX ftp プログラム(FTPクライアント)では、ホームディレクトリに「.netrc」というファイルを記述することでログインなどの処理を自動化することができる。
(例)
machine リモートホスト login ログインユーザ password パスワード
上記のように記述すれば、対象のホストへ接続すると自動的にログインが行われる。
ただし、ファイルのパーミッションが悪い(ユーザ以外に参照権限がある)と怒られてしまう。
1: $ ls -l ./.netrc 2: -rw-r--r-- 1 mog staff 42 3月 5日 12:06 ./.netrc 3: $ ftp localhost 4: Connected to localhost. 5: 220 freya.local FTP server ready. 6: Error - .netrc file not correct mode. 7: Remove password or correct mode. 8: 221 Goodbye. 9: No control connection for command: ファイル番号が違います。 10: ftp>chmod すれば想定どおりの動きになる。
1: $ ls -l ./.netrc 2: -rw------- 1 mog staff 42 3月 5日 12:06 ./.netrc 3: $ ftp localhost 4: Connected to localhost. 5: 220 freya.local FTP server ready. 6: 331 Password required for mog. 7: 230 User mog logged in. 8: Remote system type is UNIX. 9: Using binary mode to transfer files.10: ftp>
0 件のコメント:
コメントを投稿