Net-SFTP-SftpServer
view release on metacpan or search on metacpan
print "\n\rYou do not have permission to login interactively to this host.\n\r\n\rPlease contact the system administrator if you believe this to be a configuration error.\n\r";
exit 1;
}
my $MEMLIMIT = 100 * 1024 * 1024; # 100 Mb
# hard limits on process memory usage;
setrlimit( RLIMIT_RSS, $MEMLIMIT, $MEMLIMIT );
setrlimit( RLIMIT_VMEM, $MEMLIMIT, $MEMLIMIT );
my $debug = (defined DEBUG_USER->{uc(getpwuid($>))} and DEBUG_USER->{uc(getpwuid($>))}) ? 1 : 0;
my $sftp = Net::SFTP::SftpServer->new(
debug => $debug,
home => '/var/upload/sftp',
file_perms => 0660,
on_file_sent => \&ActionOnSent,
on_file_received => \&ActionOnReceived,
use_tmp_upload => 1,
max_file_size => 200 * 1024 * 1024,
valid_filename_char => [ 'a' .. 'z', 'A' .. 'Z', '0' .. '9', '_', '.', '-' ],
bin/sftp-server.pl view on Meta::CPAN
print "\n\rYou do not have permission to login interactively to this host.\n\r\n\rPlease contact the system administrator if you believe this to be a configuration error.\n\r";
exit 1;
}
my $MEMLIMIT = 100 * 1024 * 1024; # 100 Mb
# hard limits on process memory usage;
setrlimit( RLIMIT_RSS, $MEMLIMIT, $MEMLIMIT );
setrlimit( RLIMIT_VMEM, $MEMLIMIT, $MEMLIMIT );
my $debug = (defined DEBUG_USER->{uc(getpwuid($>))} and DEBUG_USER->{uc(getpwuid($>))}) ? 1 : 0;
my $sftp = Net::SFTP::SftpServer->new(
debug => $debug,
home => '/var/upload/sftp',
file_perms => 0660,
on_file_sent => \&ActionOnSent,
on_file_received => \&ActionOnReceived,
use_tmp_upload => 1,
max_file_size => 200 * 1024 * 1024,
valid_filename_char => [ 'a' .. 'z', 'A' .. 'Z', '0' .. '9', '_', '.', '-' ],
lib/Net/SFTP/SftpServer.pm view on Meta::CPAN
"No such file", #/* SSH2_FX_NO_SUCH_FILE */
"Permission denied", #/* SSH2_FX_PERMISSION_DENIED */
"Failure", #/* SSH2_FX_FAILURE */
"Bad message", #/* SSH2_FX_BAD_MESSAGE */
"No connection", #/* SSH2_FX_NO_CONNECTION */
"Connection lost", #/* SSH2_FX_CONNECTION_LOST */
"Operation unsupported", #/* SSH2_FX_OP_UNSUPPORTED */
"Unknown error" #/* Others */
];
my $USER = getpwuid($>);
my $ESCALATE_DEBUG = 0;
# --------------------------------------------------------------------
# Do evilness with symbol tables to ge
sub import{
my $self = shift;
my $opt = {};
if (ref $_[0] eq 'HASH'){
$opt = shift;
}
$opt->{log} ||= 'daemon';
lib/Net/SFTP/SftpServer.pm view on Meta::CPAN
return;
}
#-------------------------------------------------------------------------------
sub lsFile {
my $self = shift;
my $name = shift;
my $st = shift;
my @ltime = localtime($st->[9]);
my $mode = format_mode($st->[2]);
my $user = getpwuid($st->[4]);
my $group = getgrgid($st->[5]);
my $sz;
if (scalar @ltime) {
if (time() - $st->[9] < (365*24*60*60)/2){
$sz = strftime "%b %e %H:%M", @ltime;
}
else {
$sz = strftime "%b %e %Y", @ltime;
}
}
lib/Net/SFTP/SftpServer.pm view on Meta::CPAN
print "\n\rYou do not have permission to login interactively to this host.\n\r\n\rPlease contact the system administrator if you believe this to be a configuration error.\n\r";
exit 1;
}
my $MEMLIMIT = 100 * 1024 * 1024; # 100 Mb
# hard limits on process memory usage;
setrlimit( RLIMIT_RSS, $MEMLIMIT, $MEMLIMIT );
setrlimit( RLIMIT_VMEM, $MEMLIMIT, $MEMLIMIT );
my $debug = (defined DEBUG_USER->{uc(getpwuid($>))} and DEBUG_USER->{uc(getpwuid($>))}) ? 1 : 0;
my $sftp = Net::SFTP::SftpServer->new(
debug => $debug,
home => '/var/upload/sftp',
file_perms => 0660,
on_file_sent => \&ActionOnSent,
on_file_received => \&ActionOnReceived,
use_tmp_upload => 1,
max_file_size => 200 * 1024 * 1024,
valid_filename_char => [ 'a' .. 'z', 'A' .. 'Z', '0' .. '9', '_', '.', '-' ],
( run in 0.280 second using v1.01-cache-2.11-cpan-8d75d55dd25 )