AnyEvent-FTP
view release on metacpan or search on metacpan
- FTPd
- bftpd
- ftpd
- vsftpd
- wu
- NcFTPd
- syst
- SYST
- ALLO
- standalone
- stderr
- auth
- cred
- inet
- pam
- readonly
- RETR
- VMS
- authenticator
- TCP
- FSRW
use Pod::Usage qw( pod2usage );
# PODNAME: aeftpd
# ABSTRACT: FTP Server
our $VERSION = '0.19'; # VERSION
my $port;
my $host;
my $inet = 0;
my $stderr;
my $chroot = 0;
my $verbose = 0;
my $cred;
my $simple_auth_class;
my @simple_auth_args;
my $default_context = 'FSRW';
GetOptions(
'port=i' => \$port,
'hostname=s' => \$host,
'inet' => \$inet,
'stderr=s' => \$stderr,
'pam=s' => sub { $simple_auth_class = 'PAM'; push @simple_auth_args, service => $_[1] },
'chroot' => \$chroot,
'verbose' => \$verbose,
'cred=s' => \$cred,
'context=s' => \$default_context,
'auth=s' => sub { $_[1] =~ /^(.*?)=(.*)$/ ? (push @simple_auth_args, $1 => $2) : ($simple_auth_class = $_[1]) },
'help|h' => sub { pod2usage({ -verbose => 2}) },
'version' => sub { say 'aeftp/AnyEvent::FTP version ', ($AnyEvent::FTP::Server::VERSION // 'dev'); exit 1 },
) || pod2usage(1);
$0 = 'aeftpd';
$port //= ($> && $^O !~ /^(cygwin|MSWin32)$/) ? undef : 21;
if($stderr)
{
open STDERR, '>>', $stderr;
}
$cred = 'random'
if ! defined($cred) && ! defined($simple_auth_class);
if(defined $cred && $cred eq 'random')
{
$cred = {
user => (join '', map { chr(ord('a') + int rand(26)) } (1..10)),
pass => (join '', map { chr(ord('a') + int rand(26)) } (1..10)),
=head1 VERSION
version 0.19
=head1 SYNOPSIS
% aeftpd [ --port port ]
[ --hostname hostname ]
[ --inet ]
[ --stderr path ]
[ --context context ]
[ --chroot ]
--pam service |
--cred user:pass |
--cred random |
--auth class [ --auth key=val ]
[ --verbose ]
% aeftpd --version
% aeftpd --help
The hostname or IP address to listen on.
=head2 --inet
Run in inet mode. By default C<aeftpd> runs as a single process in standalone mode.
By using this option you can run C<aeftp> from C<inetd>, C<xinetd> or similar daemon.
Here is a line for /etc/inetd.conf which was tested on Debian Wheezy, and may work
for you if your operating system supports PAM and you have L<Authen::Simple::PAM>
installed.
ftp stream tcp nowait root /usr/sbin/tcpd aeftpd --inet --stderr /tmp/aeftp.log --pam login
=head2 --stderr I<path>
Redirect stderr from the daemon to the file specified by the given path
=head2 --chroot
Use C<chroot> to restrict the user to only his home directory once he has logged
in. This option requires the C<chroot> function, which is supported by Perl on
most UNIX and UNIX like operating systems.
=head2 --cred [ I<user>:I<pass> | random ]
Allow authentication with the given username and password. If you specify C<random>
Use PAM for authentication. This option is simply a shortcut. This:
% aeftpd --pam login
is the same as
% aeftpd --auth PAM --auth service=login
=head2 --verbose
Print all FTP commands and their responses to stderr.
=head2 --context I<context>
Set the default context. The default is FSRW.
=head2 --version
Print out the L<AnyEvent::FTP> version to stdout and exit.
=head2 --help
( run in 0.630 second using v1.01-cache-2.11-cpan-49f99fa48dc )