Debian 13 trixie

FTP : FTP Client (Debian)2025/09/15

 

Configure Client computer to connect to FTP Server. The example below is for Debian.

[1] Install FTP Client.
root@client:~#
apt -y install lftp
[2] Connect to FTP Server as any common users.
# lftp [option] [hostname]

trixie@client:~$
lftp -u debian www.srv.world

Password:   # password of the user
lftp debian@www.srv.world:~>

# show current directory on FTP server
lftp debian@www.srv.world:~> pwd
ftp://debian@www.srv.world

# show current directory on localhost
lftp debian@www.srv.world:~> !pwd
/home/debian

# show files in current directory on FTP server
lftp debian@www.srv.world:~> ls
-rwx------    1 1000     1000           23 Sep 15 01:26 test.sh
drwxr-xr-x    2 1000     1000         4096 Sep 15 01:25 testdir
-rw-r--r--    1 1000     1000        12813 Sep 15 01:25 testfile.txt

# show files in current directory on localhost
lftp debian@www.srv.world:~> !ls -l
total 8
-rw-r--r-- 1 debian debian 3771 Sep 15 01:29 test.txt
-rw-r--r-- 1 debian debian  220 Sep 15 01:29 debian.txt

# change directory
lftp debian@www.srv.world:~> cd testdir
lftp debian@www.srv.world:~/testdir> pwd
ftp://debian@www.srv.world/%2Fhome/debian/testdir

# upload files to FTP server
lftp debian@www.srv.world:~/testdir> put debian.txt test.txt
3991 bytes transferred
Total 2 files transferred
lftp debian@www.srv.world:~/testdir> ls
-rw-------    1 1000     1000         3771 Sep 15 01:31 test.txt
-rw-------    1 1000     1000          220 Sep 15 01:31 debian.txt

lftp debian@www.srv.world:~/testdir> cd
cd ok, cwd=/home/debian

# set permission to overwrite files on localhost when using [get/mget]
lftp debian@www.srv.world:~> set xfer:clobber on

# download files from FTP server
lftp debian@www.srv.world:~> get testfile.txt test.sh
12836 bytes transferred
Total 2 files transferred

# create a directory in current directory on FTP Server
lftp debian@www.srv.world:~> mkdir testfolder
mkdir ok, `testfolder' created
lftp debian@www.srv.world:~> ls
-rwx------    1 1000     1000           23 Sep 15 01:26 test.sh
drwxr-xr-x    2 1000     1000         4096 Sep 15 01:31 testdir
-rw-r--r--    1 1000     1000        12813 Sep 15 01:25 testfile.txt
drwx------    2 1000     1000         4096 Sep 15 01:39 testfolder

# delete a directory in current directory on FTP Server
lftp debian@www.srv.world:~> rmdir testfolder
rmdir ok, `testfolder' removed
lftp debian@www.srv.world:~> ls
-rwx------    1 1000     1000           23 Sep 15 01:26 test.sh
drwxr-xr-x    2 1000     1000         4096 Sep 15 01:31 testdir
-rw-r--r--    1 1000     1000        12813 Sep 15 01:25 testfile.txt

# delete files in current directory on FTP Server
lftp debian@www.srv.world:~> rm test.sh testfile.txt
rm ok, `test.sh' removed
lftp debian@www.srv.world:~> ls
drwxr-xr-x    2 1000     1000         4096 Sep 15 01:31 testdir

# execute commands with ![command]
lftp debian@www.srv.world:~> !cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
...
...
debian:x:1000:1000:debian:/home/debian:/bin/bash

# exit
lftp debian@www.srv.world:~> quit
Matched Content