Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 27/05/2016, à 00:00

xunil2003

Rendre vsftpd accessible depuis l'extérieur

Bonjour,

Je suis sur Kubuntu 14.04. x64.
J'ai installer vsftpd

Puis j'ai configuré mon fichier /etc/vsftpd.conf comme ceci :

laurent@laurent-PC-Bureau:~$ 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=YES
#
# Run standalone with IPv6?
# Like the listen parameter, except vsftpd will listen on an IPv6 socket
# instead of an IPv4 one. This parameter and the listen parameter are mutually
# exclusive.
#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=whoever
#
# 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=Bienvenue sur mon serveur FTP.
#
# 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
#
local_root=$HOME/Vidéos/Films/
#
# 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
# This option specifies the location of the RSA key to use for SSL
# encrypted connections.
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
laurent@laurent-PC-Bureau:~$ 

Puis j'ai redémarré le service :

sudo service vsftpd restart

j'arrive a me connecté avec mon ip local :

ftp://192.168.0.6/

Mais dès que je me connecte depuis l'extérieur rien ne fonctionne :

ftp://78.227.xx.xxx/

J'ai pourtant fait une redirection de port du port 21 en TCP et UDP de mon adresse ip sur ma Freebox.

Comment faire ?

Merci.


- AMD R9 5950x 64 Go Ram / Intel Pentium I7 960 - 12 Go Ram - 6 T0 - Kubuntu 12.04 x64 / Kubuntu 14.04 x64 / Kubuntu 16.04 x64 / Kubuntu 18.04 x64 /  Kubuntu 20.04 x64 / Mint
- DreamPlug Multi Boot / Marvel 1.22 Ghz / Architecture ARM / 512 Mo Ram / Carte-sd 16 Go class 10 / 5 Watts / Debian Squeeze 2.6.39.4
- Raspberry PI 1 / Raspberry PI 2 / Raspberry PI 3 / Raspberry PI 4 : 4Gb
JE SUIS CHARLIE

Hors ligne

#2 Le 27/05/2016, à 06:11

gl38

Re : Rendre vsftpd accessible depuis l'extérieur

Rien ne fonctionne : peux-tu donner le message d'erreur ?
Cordialement,
Guy

Hors ligne

#3 Le 27/05/2016, à 06:22

jplemoine

Re : Rendre vsftpd accessible depuis l'extérieur

De mémoire, le 21 ne suffit pas.... Je ne me souviens plus du 2ième (peut-être le 20 ou un qui l'on configure) et il faut être en mode passif (cf https://fr.wikipedia.org/wiki/File_Transfer_Protocol)


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

En ligne

#4 Le 27/05/2016, à 11:30

xunil2003

Re : Rendre vsftpd accessible depuis l'extérieur

Bonjour,

Depuis l'extérieur :

laurent@laurent-PC-Portable:~$ ftp 78.xx.xx.xxx
ftp: connect: Connection timed out
ftp> ls
Not connected.
ftp> 

En local :

laurent@laurent-PC-Bureau:~$ ftp 192.168.0.6 
Connected to 192.168.0.6.
220 Bienvenue sur mon serveur FTP.
Name (192.168.0.6:laurent): laurent
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-rw-r--    1 1000     1000         3100 Mar 14  2013 generateur-18-13V-2.sh
-rw-rw-r--    1 1000     1000         3111 Mar 13  2013 generateur-18-13V.sh
226 Directory send OK.
ftp>

Merci.

Dernière modification par xunil2003 (Le 27/05/2016, à 14:38)


- AMD R9 5950x 64 Go Ram / Intel Pentium I7 960 - 12 Go Ram - 6 T0 - Kubuntu 12.04 x64 / Kubuntu 14.04 x64 / Kubuntu 16.04 x64 / Kubuntu 18.04 x64 /  Kubuntu 20.04 x64 / Mint
- DreamPlug Multi Boot / Marvel 1.22 Ghz / Architecture ARM / 512 Mo Ram / Carte-sd 16 Go class 10 / 5 Watts / Debian Squeeze 2.6.39.4
- Raspberry PI 1 / Raspberry PI 2 / Raspberry PI 3 / Raspberry PI 4 : 4Gb
JE SUIS CHARLIE

Hors ligne

#5 Le 27/05/2016, à 13:40

gl38

Re : Rendre vsftpd accessible depuis l'extérieur

Dans ton fichier de configuration il y a

connect_from_port_20=YES

il semble donc qu'il faudrait rediriger le port 20 dans la baox.
Cordialement,
Guy

Hors ligne

#6 Le 27/05/2016, à 14:40

xunil2003

Re : Rendre vsftpd accessible depuis l'extérieur

Bonjour,

Faut-il ajouter le port en UDP ou TCP ?

Merci.


- AMD R9 5950x 64 Go Ram / Intel Pentium I7 960 - 12 Go Ram - 6 T0 - Kubuntu 12.04 x64 / Kubuntu 14.04 x64 / Kubuntu 16.04 x64 / Kubuntu 18.04 x64 /  Kubuntu 20.04 x64 / Mint
- DreamPlug Multi Boot / Marvel 1.22 Ghz / Architecture ARM / 512 Mo Ram / Carte-sd 16 Go class 10 / 5 Watts / Debian Squeeze 2.6.39.4
- Raspberry PI 1 / Raspberry PI 2 / Raspberry PI 3 / Raspberry PI 4 : 4Gb
JE SUIS CHARLIE

Hors ligne

#7 Le 27/05/2016, à 17:03

gl38

Re : Rendre vsftpd accessible depuis l'extérieur

Je ne sais pas, je commencerais par essayer TCP.
Cordialement,
GUy

Hors ligne

#8 Le 30/05/2016, à 19:55

xunil2003

Re : Rendre vsftpd accessible depuis l'extérieur

Bonsoir,

J'ai ouvert le port en UDP et TCP

Depuis la Freebox V6 onglet :
Redirections / Baux DHCP
Redirections de ports

PORT EXTERNE - PROTOCOLE - IP DE DESTINATION - PORT INTERNE
20 - TCP - 192.168. 0. 6 - 20	
20 - UDP - 192.168. 0. 6 - 20	

Mais depuis l'extérieur ça marche pas

laurent@laurent-PC-Portable:~$ ftp 78.xx.xx.xxx
ftp: connect: Connection timed out
ftp> ls -al
Not connected.
ftp>

Comment faire ?

Merci.


- AMD R9 5950x 64 Go Ram / Intel Pentium I7 960 - 12 Go Ram - 6 T0 - Kubuntu 12.04 x64 / Kubuntu 14.04 x64 / Kubuntu 16.04 x64 / Kubuntu 18.04 x64 /  Kubuntu 20.04 x64 / Mint
- DreamPlug Multi Boot / Marvel 1.22 Ghz / Architecture ARM / 512 Mo Ram / Carte-sd 16 Go class 10 / 5 Watts / Debian Squeeze 2.6.39.4
- Raspberry PI 1 / Raspberry PI 2 / Raspberry PI 3 / Raspberry PI 4 : 4Gb
JE SUIS CHARLIE

Hors ligne

#9 Le 30/05/2016, à 19:59

jplemoine

Re : Rendre vsftpd accessible depuis l'extérieur

Il n'y a rien dans un log quelconque ?


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

En ligne

#10 Le 30/05/2016, à 22:35

xunil2003

Re : Rendre vsftpd accessible depuis l'extérieur

Bonsoir,

Y a rien dans le log .

/var/log/vsftpd.log :

Mon May 30 19:59:15 2016 [pid 9587] CONNECT: Client "192.168.0.6"
Mon May 30 19:59:17 2016 [pid 9586] [anonymous] FAIL LOGIN: Client "192.168.0.6"
Mon May 30 19:59:18 2016 [pid 9608] CONNECT: Client "192.168.0.6"
Mon May 30 23:24:35 2016 [pid 31463] CONNECT: Client "192.168.0.6"
laurent@laurent-PC-Portable:~$ ftp 78.xx.xxx.xx
ftp: connect: Connection refused
ftp> ls
Not connected.
ftp> quit
laurent@laurent-PC-Portable:~$

ça marche quand local ?

Merci.


- AMD R9 5950x 64 Go Ram / Intel Pentium I7 960 - 12 Go Ram - 6 T0 - Kubuntu 12.04 x64 / Kubuntu 14.04 x64 / Kubuntu 16.04 x64 / Kubuntu 18.04 x64 /  Kubuntu 20.04 x64 / Mint
- DreamPlug Multi Boot / Marvel 1.22 Ghz / Architecture ARM / 512 Mo Ram / Carte-sd 16 Go class 10 / 5 Watts / Debian Squeeze 2.6.39.4
- Raspberry PI 1 / Raspberry PI 2 / Raspberry PI 3 / Raspberry PI 4 : 4Gb
JE SUIS CHARLIE

Hors ligne

#11 Le 30/05/2016, à 23:19

jplemoine

Re : Rendre vsftpd accessible depuis l'extérieur

Es-tu sûr que la connexion est autorisée en anonyme ?
Si non, on dirait que de l'extérieur, c'est une connexion anonyme.
Tu testes comment l'accès depuis l'extérieur ?


Membre de l'ALDIL (Association Lyonnaise pour le Développement de l'Informatique Libre)
- En pro, après 20 ans de développement, administrateur Linux / Unix depuis Avril 2019.
- En privé, sous Ubuntu-Xubuntu depuis 2009.

En ligne

#12 Le 31/05/2016, à 07:33

gl38

Re : Rendre vsftpd accessible depuis l'extérieur

Si la box renvoie bien sur ton ordinateur, il doit y avoir un message dans /var/log, dans les fichiers syslog et auth.log.
S'il n'y a rien, c'est que la redirection n'est pas installée correctement.
Est-ce que tu arrives à te connecter depuis l'extérieur avec ssh sur le port 22 après avoir installé openssh-server et redirigé le port 22 ?
Cordialement,
Guy

Hors ligne

#13 Le 02/06/2016, à 23:36

xunil2003

Re : Rendre vsftpd accessible depuis l'extérieur

Bonsoir,

jplemoine a écrit :

Es-tu sûr que la connexion est autorisée en anonyme ?

Non pas de connexion en anonyme !

laurent@laurent-PC-Portable:~$ ssh 78.xxx.xx.xxx:22
ssh: connect to host 78.xxx.xx.xxx port 22: Connection refused
laurent@laurent-PC-Portable:~$ 
jplemoine a écrit :

Tu testes comment l'accès depuis l'extérieur ?

depuis une autre PC avec autre connexion internet ou depuis mon téléphone Android via internet 3/4G.


gl38 a écrit :

Si la box renvoie bien sur ton ordinateur, il doit y avoir un message dans /var/log, dans les fichiers syslog et auth.log.
S'il n'y a rien, c'est que la redirection n'est pas installée correctement.
Est-ce que tu arrives à te connecter depuis l'extérieur avec ssh sur le port 22 après avoir installé openssh-server et redirigé le port 22 ?

Non je n'arrive pas a me connecter en ssh depuis l’extérieur.
le paquet openssh-server est déjà installé.
Le port 22 et déjà redirigé vers l'ip de mon pc dans la freebox.
Rien dans le fichier /var/log/syslog et dans le fichier /var/log/auth.log, j'ai trouvé ceci :

Jun  2 12:09:30 laurent-PC-Portable sshd[1315]: Server listening on 0.0.0.0 port 22.
Jun  2 12:09:30 laurent-PC-Portable sshd[1315]: Server listening on :: port 22.

Comment vérifier si un pare-feu est activé dans le pc ?

Merci.

Dernière modification par xunil2003 (Le 02/06/2016, à 23:40)


- AMD R9 5950x 64 Go Ram / Intel Pentium I7 960 - 12 Go Ram - 6 T0 - Kubuntu 12.04 x64 / Kubuntu 14.04 x64 / Kubuntu 16.04 x64 / Kubuntu 18.04 x64 /  Kubuntu 20.04 x64 / Mint
- DreamPlug Multi Boot / Marvel 1.22 Ghz / Architecture ARM / 512 Mo Ram / Carte-sd 16 Go class 10 / 5 Watts / Debian Squeeze 2.6.39.4
- Raspberry PI 1 / Raspberry PI 2 / Raspberry PI 3 / Raspberry PI 4 : 4Gb
JE SUIS CHARLIE

Hors ligne

#14 Le 03/06/2016, à 17:34

gl38

Re : Rendre vsftpd accessible depuis l'extérieur

As-tu vérifié que ta box n'est pas sur sécurité maximale ?
Normalement le pare-feu d'ubuntu s'appelle ufw, il est installé mais pas opérationnel sauf si on le met en marche volontairement.
Cordialement,
Guy

Hors ligne