transfermode types in sftp - ftp

Is there any difference between ftp and sftp tranfser types in terms of transfer modes (binary, ASCII)? In sftp transfer do we still have binary and ASCII transfer option or it has its default mode whether we choose or not.

SFTP works on top of ssh and does not have equivalent for FTP transfer mode. In other words, SFTP transfer is always binary, byte to byte exact.
You should not confuse SFTP with FTPS though. FTPS is much like old FTP, but over SSL, and is supported by some servers. Because it is still old FTP wrapped in SSL, it does support notion of transfer mode (ascii or binary). However, FTPS servers are very rare in the wild, and I think it is very difficult to actually encounter one.

Related

AS400 FTP to windows server

I want to write a CLLE Program to transfer Files from the IFS to a Webserver.
The Webserver is registered in the Hosttable from the Iseries.
(commandline: CFGTCP -> Option 10 -> Scroll to the Webserver IP)
Current CLLE Program: (only the ftp-access)
PGM
OVRDBF FILE(INPUT) TOFILE(CMDDTAR7_2/US9FIP) OVRSCOPE(*JOB)
OVRDBF FILE(OUTPUT) TOFILE(CMDDTAR7_2/US9FOP) +
OVRSCOPE(*JOB)
FTP RMTSYS('10.1.2.99')
ENDPGM
After i call my Program i get some results in a PF-File.
The Results are in German but i translated shortly for you.
The Connection is unavalable to 10.1.2.99 on Port 21. Try it again later.
[...]
My Question at the end.
Do you have some solutions for me to transfer xml files to my Webserver from the iseries?
You're writing about a web server and you want to transfer files by ftp. Perhaps you're mixing up protocols here. I'll concentrate to resolve your apparent ftp connection problem.
Seems that the destination host 10.1.2.99 doesn't accept connections on Port 21.
Please make sure, there's no firewall or other stuff blocking your request to the destination host. Moreover, on the host 10.1.2.99 try telnet 10.1.2.99 ftp or ftp 10.1.2.99 in a command window, depending on OS and installed components.
Before automating, just test manually if you can successfully connect and log in via standard command line: ftp 10.1.2.99.
Transferring data by FTP is just fine in a local LAN. Beware that any data including username and password will be transferred in clear text and thus can be possibly read by others as the intended hosts.
Following up to your comment: Actually there are many possibilities to copy files. If you're running a recent version of IBM i, I'd opt for using scp. It's encrypted and thus safe for running outside of local LANs. Great to automate by utilizing Key-Authentication instead of passwords. And many web hosting companies offer scp/sftp access.

what is the meaning of FTP attributes in Filewatcher Property file?

The Properties file of a file watcher contains many attributes. I was not able to find the use of certain attributes. The attributes are
FTPModeBinary and
FTPConnectionPASV
these take true or false as its value.
Can anyone please help me to understand the use of these attributes?
"Binary" (as opposed to "text") transfers the file exactly as-is without doing any end-of-line conversions (like LF to CR/LF).
"Passive" means that the FTP server always opens a listening socket for the data connection and the client connects to it. (FTP uses a separate TCP channel for the actual data transfer.) Traditionally, FTP would have the sender open a connection to the receiver but this began breaking when people started residing behind NAT firewalls as there's no easy way to open a connection back to the client in that case. Without passive, it's actually possible to instruct two FTP servers to transfer a file between themselves without ever passing through the client.

Transferring files using Telnet

Is it possible to transfer files between two machines using Telnet protocol. From wikipedia,I understand that FTP & Telnet are similar. But on logging in using Telnet its very similar to logging into guest machine.
Please advise.
You cannot transfer a raw binary file over telnet because there are some codes that are reserved and will be escaped before transmission. Your local telnet terminal would also interpret other codes as cursor control sequences and go wild.
So no cat stuff.zip and extracting it locally from the log file or screen cut/paste.
However, you could encode a file into something safe using uuencode or base64, capture that on the local side, and decode it using the appropriate tool to get the original binary back.
But in short, just use FTP in "binary" plus "passive" mode. That's safest and what it's designed for.
That said, you should be using SSH instead of Telnet and then you can use SCP to transfer files.

What data flows through ftp port 20?

Can you please tell me specifically what kind of data flows through which port during an FTP connection?
To be specific, I'd like to know whether contents of the directory and the server response codes flow through port 20.
FTP uses two types of connections: (1) the control connection (default port 21), which is used to send commands to the server and receive status codes back, and (2) the data connection (default port 20), which is used to transfer the content requested from the server: the content of a file or a directory listing, for example. I recommend to use a network protocol analyzer to see it with your own eyes. FTP specification RFC959 is written in an easily understandable manner, don't afraid to have a look at it.

uploading code to dev or production server using ftp or using telnet, are they both not safe?

i still see people using ftp or telnet for work instead of sftp and ssh. is it true that using ftp or telnet can let people see the password quite easily? Who can actually see it?
Update: for example, if i am not using Wireless... which i heard can be breakable if it is WEP when 1GB traffic is sent or received ... so if not using Wireless, and I am using either DSL, Cable Internet like Comcast, or AT&T's U-verse's fiber optics, then who can read it? Can my neighbor, or joe at the data center at a nearby company or university read it? Or joe at a big hosting company or data center that happens to be some where between California and Chicago if I am ftp'ing from California to Chicago?
Update 2: so maybe it is good to alias ftp='echo use sftp!!' on the bash too
To answer briefly, anyone on the path of the packets from your pc to the server.
In some cases (insecure networks, wireless networks, and so on) many more persons.
That's because the password will travel in plain text.
You can see more about packet sniffing at http://en.wikipedia.org/wiki/Packet_capture.
Also check http://en.wikipedia.org/wiki/File_Transfer_Protocol#Security_problems
Both ftp and telnet are unencrypted. That means that anyone who can capture your internet traffic (e.g. your isp, hosting provider, maybe government) can read your password in plain text averytime you login. Ssh and sftp/scp will encrypt your password and none should be able to read it.
Yes, by using a simple packet sniffer, such as Wireshark it is possible to read the plaintext passwords used by telnet and ftp. Try using this tool while initializing a ftp or telnet session and you'll see how non-secure these mechanisms are.
As tagged with this post, ssh and sftp are more secure alternatives as they encrypt the data as it moves across the wire. And, as always, never use these sorts of tools for evil!
Anyone with a sniffer can see it. Use the secure equivalents i.e. SFTP and SSH instead. They are protected with strong encryption and everything will be encrypted.

Resources