http://www.mavetju.org/unix/netrc.php
http://linux.about.com/library/cmd/blcmdl5_netrc.htm
创建.netrc
放在$HOME目录下
除了owner之外,任何人都不能读取
可以使用
chmod 600 ~/.netrc
配置说明
1、machine定义
machine ftp.freebsd.org
login anonymous
password [email protected]
machine myownmachine
login myusername
password mypassword
当
ftp ftp.freebsd.org
时,会自动使用配置文件里面的用户名密码登陆
宏定义
macdef uploadtest
cd /pub/tests
bin
put filename.tar.gz
quit
macdef dailyupload
cd /pub/tests
bin
put daily-$1.tar.gz
quit
使用
[~] edwin@k7>ftp myownmachine
ftp: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
220 myownmachine FTP server (Version 6.00LS) ready.
331 Password required for myusername.
230 User myusername logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> $ uploadtest
cd temp
250 CWD command successful.
put filename.tar.gz
local: filename.tar.gz remote: filename.tar.gz
150 Opening BINARY mode data connection for 'filename.tar.gz'
100% |**************************************************| 1103 00:00 ETA
226 Transfer complete.
1103 bytes sent in 0.01 seconds (215.00 KB/s)
quit
221 Goodbye.