0% found this document useful (0 votes)
75 views4 pages

Ubuntu FTP Server Setup Guide

The document provides instructions for configuring an FTP server on Ubuntu. It includes steps to install vsftpd, configure the Apache configuration files, enable FTP write access, create an FTP user, open firewall ports for FTP, and connect to the FTP server. It also describes additional configuration options like changing the FTP directory, encrypting FTP traffic with FTPS, and installing and configuring SSH.

Uploaded by

Gabriel Carvalho
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views4 pages

Ubuntu FTP Server Setup Guide

The document provides instructions for configuring an FTP server on Ubuntu. It includes steps to install vsftpd, configure the Apache configuration files, enable FTP write access, create an FTP user, open firewall ports for FTP, and connect to the FTP server. It also describes additional configuration options like changing the FTP directory, encrypting FTP traffic with FTPS, and installing and configuring SSH.

Uploaded by

Gabriel Carvalho
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

INSTALL

sudo apt-get update


sudo apt-get install vsftpd

ENTRAR PASTA APASHE

sudo nano /etc/apache2/[Link]

# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

CRRL x

sudo nano /etc/apache2/sites-available/[Link]

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName [Link]

ServerAdmin webmaster@localhost
DocumentRoot /var/www

CTRL X - fechar
Y
Enter

sudo systemctl restart apache2


sudo chown nobody:nogroup /var/www
sudo chown zabbix:zabbix /var/www
sudo chgrp www-data /var/www
sudo chgrp -R www-data /var/www
sudo chmod -R 777 /var/www
sudo nano /etc/[Link]
# 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.
chroot_local_user=YES

# Uncomment this to enable any form of FTP write command.


write_enable=YES

Final da linha adicionar o seguinte:

user_sub_token=$USER
local_root=/var/www

pasv_min_port=40000
pasv_max_port=50000

userlist_enable=YES
userlist_file=/etc/[Link]
userlist_deny=NO

CTRL + x
S

sudo nano /etc/[Link]


sudo systemctl restart vsftpd
sudo chmod a-w /var/www

---------------------------------------------------------
1 - Copia de segurança

sudo cp /etc/[Link] /etc/[Link]


---------------------------------------------------------
$ sudo nano /etc/[Link]
sudo apt-get install vsftpd

---------------------------------------------------------

2. Para iniciar o serviço e habilitá-lo na inicialização:

sudo systemctl start vsftpd


sudo systemctl enable vsftpd
---------------------------------------------------------
Etapa 4: Criar usuário FTP

sudo useradd –m testuser


sudo password testuser
sudo mkdir /home/testuser
---------------------------------------------------------
Etapa 5: configurar o firewall para permitir o tráfego de FTP

sudo ufw allow 20/tcp


sudo ufw allow 21/tcp
---------------------------------------------------------
Etapa 6: conectar ao servidor FTP do Ubuntu

sudo ftp ubuntu-ftp


---------------------------------------------------------

Configurando e protegendo o Ubuntu vsftpd Server


Alterar diretório padrão
Por padrão, o servidor FTP usa o diretório / srv / ftp como o diretório padrão.
Você pode alterar isso criando um novo diretório e alterando o diretório inicial do
usuário FTP.

sudo mkdir /srv/ftp/new_location


sudo usermod –d /srv/ftp/new_location ftp
sudo systemctl restart [Link]
---------------------------------------------------------
Autenticar usuários de FTP

sudo nano /etc/[Link]

Encontre a entrada rotulada write_enable = NO e altere o valor para “ YES .”


---------------------------------------------------------
Salve o arquivo, saia e reinicie o serviço FTP com o seguinte:

sudo systemctl restart [Link]


---------------------------------------------------------
Protegendo FTP

chroot_local_user=YES

Criar um arquivo de lista de usuários


Para criar um arquivo de lista, edite /etc/vsftpd.chroot_list e adicione um usuário
por linha.

Instrua seu servidor FTP para limitar esta lista de usuários a seus próprios
diretórios pessoais editando [Link] :

chroot_local_user=YES
chroot_list_file=/etc/vsftpd.chroot_list
---------------------------------------------------------
Reinicie o serviço vsftpd :

sudo systemctl restart [Link]


---------------------------------------------------------
Criptografar tráfego com FTPS
Outro método para proteger seu servidor FTP é criptografar o tráfego. Isso é feito
usando FTPS - File Transfer Protocol sobre SSL (Secure Socket Layer).

Para que isso funcione, os usuários precisam ser configurados com uma conta shell
no servidor FTP. Isso adicionará uma camada de criptografia segura ao seu tráfego
de FTP. Para configurar o FTPS, abra seu arquivo [Link] em um editor e
adicione as seguintes linhas:

ssl_enable=YES
rsa_cert_file=/etc/ssl/certs/[Link]

rsa_private_key_file=/etc/ssl/private/[Link]
---------------------------------------------------------
Reinicie o serviço para aplicar as alterações:

sudo systemctl restart [Link]


SSH
sudo apt-get install openssh-server
sudo service ssh status
sudo nano /etc/ssh/sshd_config
sudo service ssh restart
ssh usuario@ip-alvo
ssh usuario@ip-alvo -p numerodaporta

UFW
sudo apt install ufw.
sudo nano /etc/default/ufw (V6)
IPV6=yes
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow 22
sudo ufw allow 2222

sudo ufw enable


sudo ufw default deny

You might also like