cancel
Showing results for 
Search instead for 
Did you mean: 

ftp issue

former_member1244799
Participant
0 Kudos

Hi All,

We are using SAP CPS. We are planning to get the files from unix server(ftp installed) to ftp windows server(source) using the script 'system_ftp_mget' . For whichever the directory mentioned in the remote directory parameter for the script. We are getting the below error. The below directoy is NOT mentioned in the  'system_ftp_mget' script. Please advise.

info  2014-10-20 12:35:20,056 Eastern Daylight Time [6248-jftp tid=0] jftp.protocol - 331 Please specify the password.

info  2014-10-20 12:35:20,056 Eastern Daylight Time [6248-jftp tid=0] jftp.protocol - PASS ******

error 2014-10-20 12:35:20,352 Eastern Daylight Time [6248-jftp tid=0] jftp.protocol - 500 OOPS: cannot change directory:/home/ramana

Thank you in advance.

Regards,

Ramana


Accepted Solutions (1)

Accepted Solutions (1)

nanda_kumar21
Active Contributor
0 Kudos

the user you are using for this FTP has a home directory set and i guess the user may not have peprmission to change directory?

try with a different user and check the error logs.

Thanks

Nanda

former_member1244799
Participant
0 Kudos

Hi Nanda,

Thank you. The user is having root permissions.

Regards,

Ramana

h_carpenter
Active Contributor
0 Kudos

Hi Ramana,

Can you make sure that /home/ramana exists on the the UNIX server, please perform the following (as the user in question):

$ ls -l /home/ramana

$ id

Regards,

HP

former_member1244799
Participant
0 Kudos


Hi Carpenter,

Thank you. Directory /home/ramana exists. We also have some files in this directory which we want to move to ftp server. We specified the remote directory parameter as /home/ramana. But still the same error in the log files.

jftp.protocol - 500 OOPS: cannot change directory:/home/ramana

Regards,

Ramana

gmblom
Active Contributor
0 Kudos

Hello,

When log into an ftp server you will be placed in a directory, the ftp server forces this for you. Normally, due to security settings you will not be able to get out of this directory, or maybe you are allowed to go to some subdirectories.

You will have to specify the path to the directory you want to put stuff in relative to the directory you are logged into. So if your ftp home directory is /home/ramana you can just specify /. If your home directory is something else, you have to give a path relative to that one.

You can always try a listing of / to get and idea which directory that actually is.

Regards Gerben

former_member1244799
Participant
0 Kudos


Hi Gerben,

Thank you. I have some files in my home directory '/home/ramana' which I need to move to the ftp server.

If I get it correct

I tried specifying in the remote directory parameter in the script as '/' as well as I tried specifying /* .   I am getting the same error as before.

jftp.protocol - 500 OOPS: cannot change directory:/home/ramana

Please advise and please correct me if I need to check anything else.

Regards,

Ramana

h_carpenter
Active Contributor
0 Kudos

Hi Ramana,

Ok, assuming you did everything correctly and the user has access, you might have been bitten by SELinux.

Open SELinux Policy for ftp and make sure "Allow ftp to read/write in the user home directories" is checked.

Regards,

HP

former_member1244799
Participant
0 Kudos

Awesome. Thank you Carpenter. It worked. File transfer is successful. Job completed successfully.  But received the below error in the error log. Is it related to permisssion issues on the destination directory on the ftp windows server. Please advise.

jftp.protocol - 200 PORT command successful. Consider using PASV.

jftp.protocol - NLST /Int/SD1/out

jftp.protocol - 150 Here comes the directory listing.

jftp.protocol - 226 Transfer done (but failed to open directory).

jftp.protocol - QUIT

jftp.protocol - 221 Goodbye.

Regards,

Ramana

h_carpenter
Active Contributor
0 Kudos

Hi Ramana,

Please ensure the destination directory exists and the RunAsUser has read/write access to it.

One way of trying (in CMD.exe or any other shell):

C:\Windows\system32>ftp 10.0.0.1

Connected to 10.0.0.1.

220 Microsoft FTP Service

User (10.0.0.1:(none)): user

331 Password required for user.

Password:

230 User logged in.

ftp> ls

200 PORT command successful.

125 Data connection already open; Transfer starting.

hhh

Int

kkk

226 Transfer complete.

ftp: 15 bytes received in 0,00Seconds 15,00Kbytes/sec.

ftp> ls  /Int

200 PORT command successful.

125 Data connection already open; Transfer starting.

/Int/SD1

226 Transfer complete.

ftp: 10 bytes received in 0,00Seconds 10000,00Kbytes/sec.

ftp> ls  /Int/SD1

200 PORT command successful.

125 Data connection already open; Transfer starting.

/Int/SD1/out

226 Transfer complete.

ftp: 14 bytes received in 0,00Seconds 14,00Kbytes/sec.

ftp> ls  /Int/SD1/out

200 PORT command successful.

125 Data connection already open; Transfer starting.

226 Transfer complete.

ftp>mkdir /Int/SD1/out/test_directory

ftp>bye

Regards,

HP

former_member1244799
Participant
0 Kudos

Hi Carpenter,

Now We are able to get the files from Linux home directory '/home/ramana' and transfer it to ftp windows server after changing the below parameter

setsebool -P ftp_home_dir=1


But from the required location (/Int/SD1/out) it still fails with the below error. It looks some permission issues on the Linux. It is having read/write access for the run as user.

jftp.protocol - 200 PORT command successful. Consider using PASV.
jftp.protocol - NLST /Int/SD1/out
jftp.protocol - 150 Here comes the directory listing.
jftp.protocol - 226 Transfer done (but failed to open directory).
jftp.protocol - QUIT
jftp.protocol - 221 Goodbye.


In the below blog it says to disable the selinux as specified below to get the files from "/Int/SD1/out". Linux team don't want it to be disabled just because it will unblock the firewalls. Please advise.

http://blog.danielburrowes.com/2009/06/vsftpd-transfer-done-but-failed-to-open.html

The path is /etc/selinux/

SELINUX=disabled

Current Value is set as 'enforcing'


Regards,
Ramana


h_carpenter
Active Contributor
0 Kudos

Hi Ramana,

You are right. This blogger is certainly not talking about a production system.

You need to configure SELinux to allow this, that is all.

Please have your Linux gurus read the man pages:

man ftpd_selinux

ftpd_selinux(8) - Linux man page

After a quick browse through that, I think the following should do it:

setsebool -P allow_ftpd_full_access 1

Note that there might be other more restrictive options, SELinux is a pretty complex topic.


Regards,

HP

Message was edited by: h. Carpenter - I just noticed that the comments section of your blog already mention the proper settings.

former_member1244799
Participant
0 Kudos

Thank you very much Carpenter for helping me:-) I have provided all the information to the concerned team.  But the client finally decided to  move and copy the files using network shares which is pretty much simple.

Regards,

Ramana

Answers (0)