Problema con VSFTPD che non si avvia

Installazione, configurazione e uso di Ubuntu come server: web, ftp, mail, news, proxy, dns e altro.
Avatar utente
Marco-Sarti
Prode Principiante
Messaggi: 15
Iscrizione: mercoledì 22 novembre 2017, 20:47
Desktop: 18.04
Distribuzione: x86_64
Sesso: Maschile
Località: Torino
Contatti:

Problema con VSFTPD che non si avvia

Messaggio da Marco-Sarti »

Ciao a tutti è il mio primo post quindi abbiate pazienza se ometto cose magari ovvie. Sono stato fedelissimo windows per molto tempo e sto cercando di convertire i server a linux. Ma ho ancora qualche difficoltà. In questo caso ho preso un semplice server Ubuntu 16.04 ho installato un lamp e funziona e ora mi sto dedicando a mettere l'ftp. Ho usato varie guide indicate anche in questo forum in più ho messo ufw e abilitato le porte 80, 433, 22, 21. Nella cartella etc ho il file vsftpd.config e vsftpd.userlist e mi sembrano spiccicate alle guide. Ho creato anche l'utente MarcoS e creato gruppo ftp. Suppongo di aver anche associato MarcoS al gruppo ftp. Poi ho creato la cartella /etc/ftp/MarcoS. Purtroppo però se lancio netstat -na | grep LISTEN non vedo il servizio su. Se provo con FileZilla ovviamente non si collega.
Che sbaglio, che fare?

Grazie a chi mi aiuterà.
--------------------------------------
MS
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12946
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: Problema con VSFTPD che non si avvia

Messaggio da thece »

:ciao: e benvenuto sul Forum

non so quale guida tu abbia seguito, ma se hai voglia di ricontrollare quello che hai fatto potresti procedere seguendo i miei appunti sull'installazione e configurazione di VSFTPD (in firma).
Avatar utente
Marco-Sarti
Prode Principiante
Messaggi: 15
Iscrizione: mercoledì 22 novembre 2017, 20:47
Desktop: 18.04
Distribuzione: x86_64
Sesso: Maschile
Località: Torino
Contatti:

Re: Problema con VSFTPD che non si avvia

Messaggio da Marco-Sarti »

stasera mi sono messo e ho seguito la tua guida, ora il servizio è su lo vedo in ascolto, ma non riesco ad accederci ancora da fuori, l'unica cosa è che se metto listen YES non si tira su il servizio, per cui l'ho disabilitato. Ho creato l'utente MarcoS assegnato password e gruppo ftp, dati permessi alla cartella ma niente non riesco ad accedere. Per carita grazie alla tua guida il servizio è su ed è già un passo avanti ma vorrei riuscire a trovare un modo semi agevole per aggiungere utenze, far puntare ogni utenza ad una specifica cartella e poterla vedere. Su windows usavo FIleZilla Server, apprezzo la possibilità di scrivere a console per carità ma mi sento molto spaesato e fatico anche solo a mettere su un ftp..
Spero dipenda solo dal fatto di essere neofiti.
--------------------------------------
MS
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12946
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: Problema con VSFTPD che non si avvia

Messaggio da thece »

Dovresti chiarire cosa intendi per "da fuori". "Da fuori" della tua LAN, quindi da Internet?

Per tutto il resto direi che hai sicuramente commesso un qualche errore di configurazione quindi occorre ricontrollare tutti i passi che hai compiuto.

Iniziamo a fare qualche verifica: posta l'output di questi comandi

Codice: Seleziona tutto

cat /etc/passwd | grep ftp
cat /etc/vsftpd.conf
sudo netstat -tulnp
Avatar utente
Marco-Sarti
Prode Principiante
Messaggi: 15
Iscrizione: mercoledì 22 novembre 2017, 20:47
Desktop: 18.04
Distribuzione: x86_64
Sesso: Maschile
Località: Torino
Contatti:

Re: Problema con VSFTPD che non si avvia

Messaggio da Marco-Sarti »

ti allego quanto mi hai chiesto:

Codice: Seleziona tutto

Using username "marco".
marco@94.130.170.180's password:
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-96-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
Last login: Thu Nov 23 22:14:54 2017 from 5.87.89.232
marco@Ubuntu-1604-xenial-64-nextcloud:~$ cat /etc/passwd | grep ftp
ftp:x:110:115:ftp daemon,,,:/var/ftp/MarcoS:/usr/sbin/nologin
MarcoS:x:1001:1001:Marco Sarti:/var/ftp/MarcoS:/bin/false
marco@Ubuntu-1604-xenial-64-nextcloud:~$ cat /etc/vsftpd.conf
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=NO
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
listen_ipv6=YES
#
# Allow anonymous FTP? (Disabled by default).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
#
# If enabled, vsftpd will display directory listings with the time
# in  your  local  time  zone.  The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
chown_uploads=YES
chown_username=ftp
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
ftpd_banner=Welcome to Team Icon Server.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# 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
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
chroot_local_user=YES
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty.  Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO

#
# Uncomment this to indicate that vsftpd use a utf8 filesystem.
#utf8_filesystem=YES


marco@Ubuntu-1604-xenial-64-nextcloud:~$ sudo netstat -tulnp
[sudo] password for marco:
àActive Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State                                                                                                                                                                    PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN                                                                                                                                                                   1179/mysqld
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN                                                                                                                                                                   1185/redis-server 1
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN                                                                                                                                                                   1156/sshd
tcp6       0      0 :::80                   :::*                    LISTEN                                                                                                                                                                   1216/apache2
tcp6       0      0 :::21                   :::*                    LISTEN                                                                                                                                                                   14328/vsftpd
tcp6       0      0 :::22                   :::*                    LISTEN                                                                                                                                                                   1156/sshd
tcp6       0      0 :::443                  :::*                    LISTEN                                                                                                                                                                   1216/apache2
udp        0      0 0.0.0.0:68              0.0.0.0:*                                                                                                                                                                                        842/dhclient
marco@Ubuntu-1604-xenial-64-nextcloud:~$ à
--------------------------------------
MS
Avatar utente
thece
Tenace Tecnocrate
Tenace Tecnocrate
Messaggi: 12946
Iscrizione: lunedì 23 aprile 2007, 14:16
Distribuzione: Debian 12 (Bookworm) - KDE

Re: Problema con VSFTPD che non si avvia

Messaggio da thece »

Per quello che vedo io, il tuo server FTP è attivo, magari non fa esattamente quello che vuoi tu, ma è attivo.

Ti suggerisco di rivedere la configurazione cancellando prima tutte le righe commentate, ossia quelle che iniziano per # . In questo modo la comprensione del file risulterà più semplice.
Con un pò di Bash

Codice: Seleziona tutto

sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak
sudo sed -i 's/^#[[:blank:][:punct:][:alnum:]]*$//g' /etc/vsftpd.conf
sed -i '/^$/d' /etc/vsftpd.conf
Scrivi risposta

Ritorna a “Ubuntu su server”

Chi c’è in linea

Visualizzano questa sezione: 0 utenti iscritti e 5 ospiti