FTP error "553 Could not create file" in RHEL
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.
Example:
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.
Related videos on Youtube
user8109
Updated on September 18, 2022Comments
-
user8109 over 1 year
We need to transfer a file from local machine to remote machine. Remote machines settings are as below:
[540607@hsldevoradb ~]$ su - Saphr002 Password: [Saphr002@hsldevoradb ~]$ pwd /odi/CSV/in [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 a
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 fromftp
, it will throw a "553 Could not create file" error.C:\Users\osprbs01>ftp 192.168.5.52 Connected to 192.168.5.52. 220 (vsFTPd 2.2.2) User (192.168.5.52:(none)): Saphr002 331 Please specify the password. Password: 230 Login successful. ftp> put test.csv.odt 200 PORT command successful. Consider using PASV. 553 Could not create file. ftp>
Kindly help to transfer the file through
ftp
.-
tamarintech over 10 yearsCan 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.
-
user8109 over 10 yearsThanks for your response. SELinux is enabled in the remote server
-