Page 1 of 1

FTP (File Transfer Protocol)

Posted: 2023 May 03, 18:14
by Mihai
Connect to the computer from which we want to transfer the file (Upload), to a terminal or a command console

Code: Select all

[root @ centos ~]
Go to the directory where we want to upload the file (in our case Downloads)

Code: Select all

[root @ centos ~] cd /home/user/Downloads
[root @ centos Downloads]
Open the ftp application

Code: Select all

[root @ localhost Downloads]# ftp
ftp>
Connect to the destination server

Code: Select all

ftp> open 192.168.30.2
Connected to 192.168.30.2 (192.168.30.2).
220 ProFTPD 1.3.4a Server (Debian) [192.168.30.2]
The login credentials of the station where we want to upload the data, will be requested (in our case the user used is "myuser")

Code: Select all

Name (192.168.30.2:root): myuser
331 Password required for myuser
Password:
230 User myuser logged in
Remote system type is UNIX.
Using binary mode to transfer files.
Access the directory where we want to upload the file on the remote server

Code: Select all

ftp> cd /home/myuser/Downloads
250 CWD command successful
Check if there is another file with the same name as our file that we want to upload

Code: Select all

ftp> ls -a
227 Entering Passive Mode (192,168,30,2,174,186).
150 Opening ASCII mode data connection for file list
drwxr-xr-x 2 myuser myuser 4096 Jul 16 2014 .
drwxr-xr-x 21 myuser myuser 4096 Sep 3 17:04 ..
-rw-rw-r-- 1 myuser myuser 341830 Jul 16 2014 openssh-server_5.9p1-5ubuntu1_i386.deb
226 Transfer complete
Upload the file (in our case the file is called "My File.z")

Code: Select all

ftp> put FisierulMeu.z FisierulMeu.z
local: FisierulMeu.z remote: FisierulMeu.z
227 Entering Passive Mode (192,168,30,3,196,70).
150 Opening BINARY mode data connection for FisierulMeu.z
226 Transfer complete
3041285 bytes sent in 0.229 secs (13295.53 Kbytes/sec)
Check if the file has been uploaded

Code: Select all

ftp> ls -a
227 Entering Passive Mode (192,168,30,2,161,250).
150 Opening ASCII mode data connection for file list
drwxr-xr-x 2 myuser myuser 4096 Jan 28 16:27 .
drwxr-xr-x 21 myuser myuser 4096 Sep 3 17:04 ..
-rw-r--r-- 1 myuser myuser 3041285 Jan 28 16:27 FisierulMeu.z
-rw-rw-r-- 1 myuser myuser 341830 Jul 16 2014 openssh-server_5.9p1-5ubuntu1_i386.deb
226 Transfer complete
ftp> exit
221 Goodbye.