ftp自动登录问题

Q:下面是我的自动ftp到另一个server上的脚本和运行的结果,用户名和密码没有错,我直接在命令行下面就没有问题。
请问这个script该如何写?

[oracle@red bin]$ uname -a
Linux red 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown

[oracle@red bin]$ cat tst
#exp system/manager inctype=COMPLETE file=x01.dmp
ftp -n 192.168.8.253 <<!
user notes pass notes7279
bye
!
[oracle@red bin]$ ./tst
Login incorrect.
Login failed.
?Invalid command

[oracle@red bin]$
---------------------------------------------------------------

在你得home目录中建立一个.netrc文件
内容是
machine host_ipaddress login username password user_passwd
然后修改文件属性
chmod 600 .netrc

然后你输入ftp host_ipaddress 就可以自动登陆了

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus