Log into SSH via Putty or Any other SSH client
Switch to the root user
$ sudo -s
install vsftpd
$ sudo apt-get install vsftpd
activate vsftpd configuration file
$ sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig
Now here’s a thing, every tutorial online would tell you to configure your firewall (UFW) but at TenderCo We use AWS which means we do not have to use UFW firewall. Therefor just whitelist the ports in the network settings of the lightsail instance.
Port 20
Port 21
Now Prepare the user directoy
$ sudo adduser YOURUSER
it will ask you for a password so STRONGPASSWORD then press enter for everything else, i mean its not like its going to greet you like SIRI or Alexa.. so you don’t have to give it your name, address, etc.
Now Make a directory for your user to access.. most likley its going to be the website directory in our case it was /var/www/html/new_dropsprint
$ sudo mkdir /var/www/html/new_dropsprint
$ sudo chown YOURUSER:YOURUSER /var/www/html/new_dropsprint
The chown command will give the necessary permissions to YOURUSER
you can verify these permissions using:
$ sudo ls -la /var/www/new_dropsprint
YOU WILL KNOW WHEN YOU SEE IT.. SO DON’T ASK FOR THE OUTPUT.
You Will have to manually configure your vsftpd.conf file for a safe Ftp connection on an AWS lightsail instance so it wouldn’t ask you for an SSH key.
$ sudo nano /etc/vsftpd.conf
in the vsftpd.conf you need to add these.. well you can choose to find each of these and uncomment them but thats gonna take hours.. trust me I just wasted 2 hours on this. so just write them from scratch. and If its the future me that’s following this… then… listen.. YOU’RE STUPID.
So here’s what you need to copy and paste in your vsftpd.conf file.
write_enable=YES chroot_local_user=YES user_sub_token=$USER local_root=/var/www/html/new_dropsprint pasv_min_port=40000 pasv_max_port=50000 userlist_enable=YES userlist_file=/etc/vsftpd.userlist userlist_deny=NO
that’s all.
Now restart the vsftpd service.
$ sudo service vsftpd restart
now go on filezilla and try connecting to your new ftp account! GOOD JOB! HAVE A COOKIE.
Additional If you want the SSH access removed
$ sudo nano /etc/ssh/sshd_config
add the following line in the sshd_config
DenyUsers YOURUSER
ctrl+s to save and exit.
$ sudo service sshd restart
Powered by BetterDocs
You must be logged in to post a comment.