Configure FTP on AWS

6

I need to configure FTP to access the folders within / var / www on a server in AWS using Filezilla.

Can you help me?

    
asked by anonymous 26.06.2015 / 22:29

1 answer

2

The instructions vary slightly depending on which distro you are using (Ubuntu, Amazon Linux, CentOS, RedHat, etc.)

These are the steps I followed to configure the SFTP service on a Ubuntu 14.04 system a few weeks ago.

Create a group to limit access to FTP:

sudo addgroup ftpaccess

Ubuntu 14.04 already comes with openssh-server installed, if your system does not come, use: sudo apt-get install openssh-server .

Edit the / etc / ssh / sshd_config file. Look for this line:

#Subsystem sftp

And "uncomment", deleting # . Look for this other line:

PasswordAuthentication no

And change it to:

PasswordAuthentication yes

Add the following to the end of the file:

Subsystem sftp internal-sftp
Match group ftpaccess
  ChrootDirectory /var/www
  X11Forwarding no
  AllowTcpForwarding no
  ForceCommand internal-sftp

Save the file. And restart OpenSSH with sudo service ssh restart .

Creating user with FTP access:

# criando usuario que não pode fazer login no sistema
sudo useradd -m myftpuser -g ftpaccess -s /usr/sbin/nologin
# escolhendo a senha desse usuário (o comando vai pedir para vc digitar a senha)
sudo passwd myftpuser
sudo chown myftpuser:ftpaccess /var/www

As we change the owner and group of the / var / www directory, we need to ensure that the web server also continues to have access. If you are using Apache, this should be enough:

sudo adduser www-data ftpaccess

With this configuration, it should be easy to connect via SFTP using FileZilla or any other program. Example:

  • User: myftpuser
  • Password: The one you typed when you created the user
  • Host: IP of your server
  • Protocol: SFTP (important, other than simple FTP)
  • Port: 22 (this is the default for SFTP)
02.09.2015 / 05:27