Ftp client server linux

Servers

The default configuration is not ideal because anonymous access is enabled by default and IPv4 support is only enabled. Therefore, the default configuration should not be considered suitable for production uses. Some common server configuration schemes include allowing anonymous access of files, user system FTP services, and virtual users (on the server end).

Per user FTP files can be supported by special directive in the vsftp.conf file using user_sub_token . For example, this can be set to something like /home/$USER/public_ftp if we enable it (process are described below in further section «vsftpd configuration»

Managing vsftpd

Starting vsftpd: After the installation rc-service vsftpd start

If starting vsftpd went OK, you should see output similar to the following:

* Caching service dependencies . [ ok ] * Starting vsftpd. [ ok ]

Stopping vsftpd: if you want to stop the web server use stop in the same way of previous command:

Restarting or reloading vsftpd: After changing the configuration file, you must either restart or reload vsftpd in order for the new configuration to take effect. You can run one of the following commands below to achieve the desired effect:

The latter reloads vsftpd’s configuration file while the former restarts vsftpd entirely. The latter might be preferred as it prevents having to reload vsftpd entirely.

If you restarted vsftpd, there should be output similar to the following:

* Stopping vsftpd. [ ok ] * Starting vsftpd. [ ok ]

If you reloaded vsftpd, the output will be similar to the following instead:

Using the proper runlevel: using the «default» runlevel should work in most cases, although there might be custom runlevels present and it might be more desirable to add vsftpd to a runlevel other than «default». However, keep in mind that runlevels aren’t present in Docker containers because Alpine is used mostly in Docker.

To add vsftpd to a runlevel, use the following command:

rc-update add vsftpd [runlevel]

Where [runlevel] is the name of the runlevel you want to add the vsftpd service too. For example, if you want to add vsftpd to the «default» run level, run rc-update add vsftpd default

Читайте также:  Терминальные команды linux mint

Testing vsftpd

This section is assuming that vsftpd is running. At the moment, there might not be the ‘ftp’ user allowed or even available, but the server is up and running.

You can use netcat to test if a connection to the server is successful:

Be sure to change server_address with the actual IP address of the server. The common response will be OPEN if the server is running. If you receive another response, review your server configuration.

Clients

Because FTP uses a client-server architecture, you will need an FTP client if you want to interact with an FTP server. Alpine provides several packages for command-line FTP clients:

  • Job control
  • Support for bookmarks
  • Support for a built-in mirror command
  • Support for parallel file transfers
  • readline used for input

Installing lftp

lftp has been provided in the main repository since Alpine 3.6, so it’s a supported package that’s ready for production use.

Configuring lftp

The main configuration file, /etc/lftp.conf comes with different examples and comments. On startup, lftp reads /etc/lftp.conf , ~/.lftprc , and ~/.lftp/rc in that exact order. These files are used to set system-wide and user-specific settings.

In the configuration file, use the command set followed by the name of the setting followed by its value. Use on / off for boolean values. For example:

set ftp:ssl-force on set ssl:verify-certificate on set ftp:use-feat off set ftp:ssl-protect-data on

Specific settings can be set for specific servers only. Append a slash (/) in front of the server name for a specific server.

set ftp:use-feat off /example.com set ftp:ssl-force on /example.com

Note: The closure for `dns:’, `net:’, `ftp:’, `http:’, `hftp:’ domain variables is currently just the host name as you specify it in the `open’ command (with some exceptions where closure is meaningless, e.g., dns:cache-size). For some `cmd:’ domain variables the closure is the current URL without path. For other variables, it is currently not used. See examples in the sample lftp.conf.

More on lftp

By default, lftp is not very verbose about operations it performs in the background. If you want more output, you can use the ‘debug’ command (without the ‘set’ command):

  • debug 5 will display the full debug output.
  • debug 3 will only display greeting messages and error messages.
Читайте также:  Linux list shared memory

Note that using the -d switch from the command line will override any previous debug settings and the full debug output will be displayed.

If you prefer some commands to be called by another name, you can set aliases:

lftpd supports aliases in the format alias [name] [command] , where [name] is the name of the lftpd alias and [command] is the name of the lftpd command. A couple of examples are shown below:

alias dir ls alias less more alias zless zmore alias bzless bzmore alias reconnect "close; cache flush; cd ." alias edit "eval -f "get $0 -o ~/.lftp/edit.tmp.$$ && shell \\"cp -p ~/.lftp/edit.tmp.$$ ~/.lftp/edit.tmp.$$.orig && vim ~/.lftp/edit.tmp.$$ && test ~/.lftp/edit.tmp.$$ -nt ~/.lftp/edit.tmp.$$.orig\\" && put ~/.lftp/edit.tmp.$$ -o $0; shell rm -f ~/.lftp/edit.tmp.$$*"

The last alias should all be in one line. It gets a remote file, opens it with vim, and places the modified file back on the server. This can be very convenient when a file needs to be quickly edited and updated on the remote server.

Example usage

Below is an example of a mult-part download over SFTP:

$ lftp -e ‘pget -c -n 5 /path/to/file’ sftp://username@server

  • -e: execute a command
  • pget: the command for partial download, in addition to its options:
    • -c: option to resume
    • -n: option for number of parts

    PCManFM with GVfs

    While PCManFM is a file manager, installing the

    Источник

    Best Command-Line FTP Clients for Linux

    File Transfer Protocol (FTP) is a network protocol used for transferring files between a client and a server on a computer network. The very first FTP applications were made for the command line before GUI Operating Systems even became a thing and while there are several GUI FTP clients, developers still make CLI-based FTP clients for users who prefer using the old method.

    Here’s a list of the best command-line based FTP clients for Linux.

    1. FTP

    Linux Operating Systems ships with built-in FTP clients that you can easily access by entering the ftp command in your terminal.

    With FTP you can connect to servers anonymously (if this feature is enabled on the server) or using your user credentials, download/upload files between your local machine and connected servers, use aliases, etc.

    Also, when using FTP for transferring files between computers, the connection is not secure and the data is not encrypted. For a secure data transfer, use sFTP (Secure File Transfer Protocol) or SCP (Secure Copy).

    Verify FTP Connection

    2. LFTP

    LFTP is a free and open source command-line utility designed for several file transfer protocols (e.g. sftp, fish, torrent) on Unix and like Operating Systems.

    It features bookmarks, job control, support for the readline library, a built-in mirror command, and support for multiple file transfers in parallel.

    lftp is available to install from the default repositories using package manager as shown.

    $ sudo apt install lftp [On Debian/Ubuntu] $ sudo yum install lftp [On CentOs/RHEL] $ sudo dnf install lftp [On Fedora]

    3. NcFTP

    NcFTP is a free, cross-platform FTP client and the first ever alternative to the standard FTP program developed to boasts ease of use and several feature and performance enhancements to FTP.

    Its features include host redialing, background processing, auto-resume downloads, filename completion, progress meters, support for other utility programs such as ncftpput and ncftpget.

    NcFTP is available to install from the default repositories using package manager as shown.

    $ sudo apt install ncftp [On Debian/Ubuntu] $ sudo yum install ncftp [On CentOs/RHEL] $ sudo dnf install ncftp [On Fedora]

    4. cbftp

    ctftp is a flexible FTP/FXP client that enables users to transfer large files securely and efficiently without using emails. It typically works in the command line but you can run it in a semi-GUI using ncurses.

    Its features include an internal viewer that supports multiple encodings, skip-listing, remote commands for UDP call commands such as race, download, fxp, raw, idle, etc., and data encryption with AES-256, among others.

    5. Yafc

    Yafc is an open source FTP client designed as a replacement for the standard FTP program on Linux systems with support for POSIX-compliant systems.

    It is completely free with a rich features list that includes recursive get/put/fxp/ls/rm, queuing, tab completion, aliases, and support for SSH2 and proxy.

    Yafc is available to install from the default repositories using package manager as shown.

    $ sudo apt install yafc [On Debian/Ubuntu] $ sudo yum install yafc [On CentOs/RHEL] $ sudo dnf install yafc [On Fedora]

    Do you have any experience with these command line FTP clients? Or do you know alternatives that should be on this list? Feel free to drop your comments below.

    Источник

Оцените статью
Adblock
detector