I was trying to setup sftp in AWS EC2 by following the instructions in https://silicondales.com/tutorials/aws-ec2-tutorials/setup-ftp-sftp-aws-ec2-instance/
I have done below steps
- Launched a new EC2 instance
- Logged in as ec2-user
- Installed vsftpd
- Updated security group rules by Custom TCP Rules – port ranges 20-21 and 1024-1048
Below changes are done in /etc/vsftpd/vsftpd.conf
anonymous_enable=NO pasv_enable=YES pasv_min_port=1024 pasv_max_port=1048 pasv_address=[MY PUBLIC IP] chroot_local_user=YES
Created a new user and set the password
adduser silicondales passwd silicondales
Restarted /etc/init.d/vsftpd restart. It is successful as I get the message
After all this I try to connect from my local machine
sftp -oPort=1024 <username>:<password>@<public ip address>
and getting ssh: connect to host <Public_IP> port 1024: Connection refused
error.I couldn't figure out the issue. Please help me to solve this