[root@localhost ~]# cat .netrc
machine hostname
login root
password rootpassword
macdef init
cd /root/
bin
put a.txt
quit
机器 hostname
username 用户名
password 密码
宏脚本 macdef
init自动执行
引用: http://www.mavetju.org/unix/netrc.php
How to use ftp in combination with .netrc
After answering a number of questions regarding automatic FTP on Unix-systems and the involvement of .netrc in it, I created this little guide.
Permissions and location of the .netrc
The .netrc should be in your home-directory and the permissions on the file should be unreadable for everybody except the owner:
[~] edwin@k7>ls -al .netrc -rw------- 1 edwin wheel |