AIX主機FTP到LINUX服務器linux
一、SHELL腳本test.sh服務器
#!/usr/bin/kshoracle
ftp -n<<!ide
open 192.168.89.10rest
user oracle oracleserver
binarythree
cd /backup/exp/operationip
lcd /oratmp/expci
promptget
mput *
close
bye
EOF
二、執行腳本報錯
$ ./test.sh
?Invalid command
OOPS: cannot change directory:/home/oracle
Login failed.
OOPS: Not connected.
Local directory now /oratmp/exp
Interactive mode off.
Not connected.
Not connected.
$
三、在LINUX主機上修改參數
[root@L-AP-89-10 operation]# sestatus -b | grep ftp
allow_ftpd_anon_write off
allow_ftpd_full_access off
allow_ftpd_use_cifs off
allow_ftpd_use_nfs off
ftp_home_dir off
ftpd_connect_db off
httpd_enable_ftp_server off
tftp_anon_write off
[root@L-AP-89-10 operation]# setsebool -P ftp_home_dir on
[root@L-AP-89-10 operation]# sestatus -b | grep ftp
allow_ftpd_anon_write off
allow_ftpd_full_access off
allow_ftpd_use_cifs off
allow_ftpd_use_nfs off
ftp_home_dir on
ftpd_connect_db off
httpd_enable_ftp_server off
tftp_anon_write off
[root@L-AP-89-10 operation]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
[root@L-AP-89-10 operation]#
四、還報錯
P560A:/oratmp/script#./test.sh
Local directory now /oratmp/exp
Interactive mode off.
Could not create file.
五、繼續修改參數
[root@L-AP-89-10 ~]# vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disable
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@L-AP-89-10 ~]# setsebool -P allow_ftpd_full_access 1
[root@L-AP-89-10 ~]# service vsftpd restart
Shutting down vsftpd: [ OK ]
Starting vsftpd for vsftpd: [ OK ]
[root@L-AP-89-10 ~]#
六、成功執行
P560A:/oratmp/script#./test.sh
Local directory now /oratmp/exp
Interactive mode off.
P560A:/oratmp/script#