I'm trying to connect to a FTP to upload a file from a cent os box. I can access to the server, but the connection times out whenever I try to upload with 'put' command.
I can upload a file without a single problem on my local machine. It sounds like a port issue.
I've already opened outbound port 21. Are there any other ports that I need to open for uploading?
logs
ftp> put localFile remote
227 Entering Passive Mode.
ftp: connect: Connection timed out
FTP distinguishes between the control port (21) and the data ports. The latter is used for the transfer of the files and directory listing and which ports are used gets dynamically decided by the server in passive mode or the client in active mode. So if you just have a simple firewall which can only do filtering by port you need to either open all ports (e.g. switch off firewall) or at least allow all outgoing TCP connections (passive mode, active mode would be worse). If your firewall is smarter and understands FTP and your FTP connection is not encrypted (e.g. ftps) then the firewall can open the necessary ports on demand.
If you want to have tighter control with only a single port you need to use different transfer protocols on both client and server side, like sftp (e.g. file transfer over ssh).