vsftpd read only user
apt-get update
apt-get install vsftpd libpam-pwdfile
cp -v /etc/vsftpd.conf /etc/vsftpd.conf.bak
vi /etc/vsftpd.conf
anonymous_enable=NO
local_enable=YES
chroot_local_user=YES
user_config_dir=/etc/vsftpd/vsftpd-virtual-user/
virtual_use_local_privs=YES
dual_log_enable=YES
connect_from_port_20=YES
listen=YES
pam_service_name=ftp
tcp_wrappers=YES
allow_writeable_chroot=YES
service vsftpd restart
mkdir -p -v /etc/vsftpd/vsftpd-virtual-user/
cp -v /etc/pam.d/vsftpd /etc/pam.d/vsftpd.bak
session optional pam_keyinit.so force revoke
auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required pam_shells.so
auth include system-auth
account include system-auth
session include system-auth
session required pam_loginuid.so
useradd --home /home/user --gid nogroup -m --shell /bin/false user
passwd user
echo user >> /etc/vsftpd/vsftpd-virtual-user/vsftpd_user
vi /etc/vsftpd/vsftpd-virtual-user/user
local_root=/home/USERNAME
cmds_allowed=USER,PASS,SYST,FEAT,OPTS,PWD,TYPE,PASV,LIST,STOR,CWD,MKD,SIZE,MDTM,CDUP,RETR,RNFR,RNTO,QUIT
local_umask=022
write_enable=YES
To allow delete add DELE
Other options:
cmds_allowed=ABOR,CWD,LIST,MDTM,MKD,NLST, PASS,PASV,PORT,PWD,QUIT,RETR,RMD,RNFR, RNTO,SITE,SIZE,STOR,TYPE,USER,ACCT, APPE,CDUP,HELP,MODE,NOOP,REIN,STAT,STOU,STRU,SYST
Allow another user write STOR files: usermod -a -G user another_user