We need to transfer a file from local machine to remote machine. Remote machines settings are as below:

[540607@hsldevoradb ~]$ su - Saphr002
[Saphr002@hsldevoradb ~]$ pwd
[Saphr002@hsldevoradb ~]$ ls -ld /odi/CSV/in
drwxrwxr-x. 2 oraedw oedw 4096 Oct 28 18:33 /odi/CSV/in
[Saphr002@hsldevoradb ~]$ groups
Saphr002 oedw
[Saphr002@hsldevoradb ~]$ touch a
[Saphr002@hsldevoradb ~]$ ls

Here /odi/CSV/in is the home directory for the user Saphr002. There is full permission for the directory /odi/CSV/in to the user Saphr002 and we are able to create a file inside that directory remotely. But whenever we try to transfer file from ftp, it will throw a "553 Could not create file" error.

Connected to
220 (vsFTPd 2.2.2)
User ( Saphr002
331 Please specify the password.
230 Login successful.

ftp> put test.csv.odt
200 PORT command successful. Consider using PASV.
553 Could not create file.

Kindly help to transfer the file through ftp.

  • Can you check if SELinux is enforcing with the command 'sestatus'? If you are attempting to FTP to a user's home directory you most likely do not have the correct SELinux context to create files. Oct 28 '13 at 15:09
  • Thanks for your response. SELinux is enabled in the remote server
    – user44663
    Oct 29 '13 at 6:12

In order for SELinux to allow ftpd to access these files they must have the appropriate context.

The following example is from RHEL. Your paths, etc may vary:

To find the appropriate content you can use ls -Zd /var/ftp/pub (or an appropriate directory configured for ftp). You should see the SELinux contexts just before the filename.
Example: drwxr-xr-x. root root system_u:object_r:public_content_t:s0 /var/ftp/pub

public_content_t is the appropriate type for ftp content.

You can then use the chcon command with --reference or by specifying the type itself.
chcon -Rt public_content_t /odi/CSV/in or you can use
chcon --reference /var/ftp/pub /odi/CSV/in

Which one you use depends on your SELinux policies. Once completed, retry your FTP process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.