Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3k views
in Java FTP by (160 points)
hi all,
We have an issue while using the jar edtFTPj 1.5.2. We are trying to FTP a file from a Windows NT server to a HP-UX machine. This file will then be read by an Oracle stored procedure.
The problem is that the file, by default, after FTP-ing, is setting the permission for the "others" group as 0 on the UNIX machine. So Oracle cannot read this file.
We are trying to set the permissions but we noticed that this is possible only when parsing the file (UnixFileParser). Which means we will have to modify the RAW string from the server to set the permission and then FTP the file again.

Is there any other workaround to this? Or is there something we're missing?

Thanks in advance

3 Answers

0 votes
by (51.6k points)
Firstly, the UnixFileParser cannot set any permissions. It simply parses directory listings so that the names, dates, sizes, etc can be extracted from them.

Secondly, I'm unclear on where you would like to set permissions. If you are wishing to set them on your local machine, you would just use the java.io classes for that. But I guess that's not what you'd like to do; you probably want to set them on the remote machine. In this case, you might have difficulties. The FTP protocol spec does not specify how to handle permissions. This does not mean that it's impossible on all servers to do it. For example, in ProFTPD you can execute a chmod using the command "SITE CHMOD 755". You'll need to look up your server's manual to see if it supports this or some other syntax.

If it supports this syntax then you can use the FTPClient.site(string) method as follows:
ftpClient.site("CHMOD 755");


- Hans (EDT)
0 votes
by (160 points)
Thanks Hans,
I guess we were on the wrong track. We tried it out with the 'site' command and it worked exactly like we wanted. Thanks once again.
Just curious... we tried other commands like "uname -a", "mkdir" etc. (even "ls" for that matter), but none of them seem to work using the site command. Is there any criteria as to what commands can be executed using 'site'?

-Ben
0 votes
by (51.6k points)
It depends on the FTP server. SITE commands are nonstandard and so every server would implement a different set of such commands. Some implement none.

- Hans (EDT)

Categories

...