ubuntu 20.04 开启ftp服务

sudo apt install vsftpd
mkdir -p  ~/app/ftp
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak.copy

sudo mv /etc/vsftpd.conf .
perl -i.bak -e 'my $name=`whoami`;chomp ($name);my $chr="/home/"."$name";my $num;my @arr;open(RF,"vsftpd.conf");while(<RF>){push @arr,$.};$num=pop (@arr);while(<>){if ($_=~/anonymous_enable=NO/){print "anonymous_enable=YES"."\n";next};if ($_=~/local_enable=YES/){print "local_enable=NO"."\n";next};print $_;if($.==$num){print "anon_root=".$chr."/app/ftp"."\n"}}' vsftpd.conf
sudo mv vsftpd.conf* /etc/
sudo chown root:root /etc/vsftpd.conf
sudo ufw allow 21
sudo ufw allow 20
sudo service vsftpd restart


邮箱地址不会被公开。 必填项已用*标注

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

Protected with IP Blacklist CloudIP Blacklist Cloud