云主机上ubuntu linux设置VSFTPD的坑备忘

常规安装一个软件的流程:

安装工具先更新:

apt-get update

安装ftp软件:

apt install vsftpd

备份原始配置文件:

cp /etc/vsftpd.conf /etc/vsftpd.conf_default

 

添加成系统启动服务

systemctl start vsftpd
systemctl enable vsftpd

编辑:

nano /etc/vsftpd.conf

 

需要编辑的地方:

# Uncomment this to allow local users to log in. 使用本地用户
local_enable=YES

# Uncomment this to enable any form of FTP write command. 否则无法上传
write_enable=YES

# You may restrict local users to their home directories. See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.  //限制本地用户到home/用户名 目录, 不限制就会list出/Home/用户名这样的结构
chroot_local_user=YES

//ftp client如fileZilla等一般都支持被动模式,20和21端口只用于初始连接和管理。真正上传下载都用这些端口,下面这些要设置

pasv_min_port=12001
pasv_max_port=12005
pasv_enable=Yes

// 这个不设会返回550 错误,无法list根目录,参考https://askubuntu.com/questions/349857/trying-to-connect-to-vsftpd-failed-to-retrieve-directory-listing
allow_writeable_chroot=YES

编辑好之后可以重启服务尝试

service vsftpd stop

service vsftpd start

(或service vsftpd restart)

https://serverfault.com/questions/421161/how-to-configure-vsftpd-to-work-with-passive-mode

提到要 iptables -I INPUT -p tcp –dport 12001:12005 -j ACCEPT , 但好像不需要,默认的云服务器是允许的。可以用iptables –list确认。

 

结果发现不行,还要去阿里云的安全组策略打开端口tcp 20, 21, 以及范围 12001/12005 。

然后用useradd和passwd命令增加一个常规用户即可。

然后发现虽然可以list目录了,但是没法上传。553 Could not create file. – permissions?

简单粗暴地用root到home/新用户目录下chmod 777 . 完事。

 

在azure上装FileZilla

https://stackoverflow.com/questions/39095900/install-ftp-application-filezilla-server-on-your-windows-azure-virtual-machine-v

基本可以参考上文,补充几点:

  1. 990端口不是必须的
  2. 14747端口本来是给ftp admin用的。本来默认就是只能本地配置,如果不开放远程,不需要用。文中用它来做ftp passive mode下server指定client连接执行指令用的端口,实际上可以用一个范围,比如50000-50255之类的。
  3. 这个范围除了azure network incoming rule之外,vm本身的系统防火墙incoming rule也要加。还有配置到fileZilla的passive mode setting里。缺一不可,否则能连上但是无法执行指令。
  4. don’t forget Passive Mode Settings’ Retrieve External Ip Address from.
  5. don’t forget the outbound rule for port 21, it’s crucial to keep the FTP connection alive.

Form 8949

Form 8949 “Sales and Other Dispositions of Capital Assets” 是Form 1040 “U.S. Individual Income Tax Return”里D部分Capital Gains and Losses的一个附件

 

下面这篇文章介绍了关于adjust cost basis(其实最后是直接调整收益)

Adjust cost basis for ESPP/RSU tax return

有一点要注意,以Charles Schwab公司的1099B为例,现在金融机构每年一月底都会发布去年的1099B或者1099 composite,里面包含1099Div(Dividends) 1099 Int(Interests) 和1099B(Brokerage?) 虽然电子版的1099B是已经包括了填8949时应该选的Box (A-F选一个),但是它会明确说明这笔交易的Cost Basis是否已经上报给IRS,如果已经上报,但是上报的却又是错误的值,就需要调整。而调整的根据是平时收到的纸质的Statement(系统太烂), 纸质的Statement里居然有真正的包含税的Cost,这个Cost比它上报给IRS的要高(因为含税),所以可以把收益调低一点。毕竟,所有收益都要交百分之十几的税。

不过这种投资里Cost已经交税,而且上报了错误的Cost的情况不多,主要就是ESPP, 工资里作为W2收入已经扣税。

还有一个是RSU,在Vesting的时候也已经作为W2扣税,所以在Lapse的时候可以看到Cost已经被加上了税,但是Charles Schwab并没有将其上报IRS,所以填8949的时候不需要调整,直接填正确的含税的Cost就行,和纸质的Statement比较过,1099B里的Cost是已含税的。但是ETrade的1099B,无论是RSU还是ESPP,是否能正确含税就不知道了,卖出后报税时要和之前的纸质Statement再核对一遍。

Box A到F的选择,再报税软件里都有,Credit Karma Tax里用的是short(long) term covered/uncovered的说法,基本上,Cover就是report给IRS了的意思。