Installare un server FTP

Se avete problemi con l'installazione e la configurazione di Slackware postate qui. Non usate questo forum per argomenti generali... per quelli usate Gnu/Linux in genere.

Moderatore: Staff

Regole del forum
1) Citare sempre la versione di Slackware usata, la versione del Kernel e magari anche la versione della libreria coinvolta. Questi dati aiutano le persone che possono rispondere.
2) Per evitare confusione prego inserire in questo forum solo topic che riguardano appunto Slackware, se l'argomento è generale usate il forum Gnu/Linux in genere.
3) Leggere attentamente le risposte ricevute.
4) Scrivere i messaggi con il colore di default, evitare altri colori.
5) Scrivere in Italiano o in Inglese, se possibile grammaticalmente corretto, evitate stili di scrittura poco chiari, quindi nessuna abbreviazione tipo telegramma o scrittura stile SMS o CHAT.
6) Appena registrati è consigliato presentarsi nel forum dedicato.

La non osservanza delle regole porta a provvedimenti di vari tipo da parte dello staff, in particolare la non osservanza della regola 5 porta alla cancellazione del post e alla segnalazione dell'utente. In caso di recidività l'utente rischia il ban temporaneo.
Avatar utente
darkstaring
Linux 3.x
Linux 3.x
Messaggi: 658
Iscritto il: mer 13 ott 2010, 13:55
Nome Cognome: Francesco Achenza
Desktop: KDE
Distribuzione: Arch Linux
Contatta:

Installare un server FTP

Messaggio da darkstaring »

Ciao a tutti :) !..
Vorrei realizzare un piccolo server ftp, ho letto qualche guida sul web, ed ho modificato /etc/vsftpd.conf così:

Codice: Seleziona tutto

# 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.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# 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
#
# 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=Welcome to Francesco FTP service ;) !
#
# 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 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().
#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
#
# When "listen" directive is enabled, vsftpd runs in standalone mode (rather
# than from inetd) and listens on IPv4 sockets. To use vsftpd in standalone
# mode rather than with inetd, change the line below to 'listen=YES'
# This directive cannot be used in conjunction with the listen_ipv6 directive.
listen=NO
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YES

Ma quando vado a lanciare vsftpd ho:

Codice: Seleziona tutto

bash-4.1# vsftpd
500 OOPS: vsftpd: not configured for standalone, must be started from inetd
Perchè?
E' possibile far coesistere vsftpd con httpd?

Thank's :)

Avatar utente
conraid
Staff
Staff
Messaggi: 13631
Iscritto il: gio 14 lug 2005, 0:00
Nome Cognome: Corrado Franco
Slackware: current64
Desktop: kde
Località: Livorno
Contatta:

Re: Realizzare un server FTP o HTTP :)

Messaggio da conraid »

mi sembra chiaro il messaggio di errore :-)

devi usare inetd, quindi decommenta la voce relativa nel file /etc/inetd.conf e poi rendi eseguibile /etc/rc.d/rc.inetd

per il resto, certo che sì, anzi, normalmente si fanno coesistere, anche perché sarebbe difficile caricare i file su un server web altrimenti

Avatar utente
darkstaring
Linux 3.x
Linux 3.x
Messaggi: 658
Iscritto il: mer 13 ott 2010, 13:55
Nome Cognome: Francesco Achenza
Desktop: KDE
Distribuzione: Arch Linux
Contatta:

Re: Realizzare un server FTP o HTTP :)

Messaggio da darkstaring »

Thank's boss :)

Codice: Seleziona tutto

bash-4.1# cat /etc/inetd.conf | grep ftp                                                                                                                                
ftp     stream  tcp     nowait  root    /usr/sbin/tcpd  vsftpd                                                                                                          
ftp     stream  tcp     nowait  root    /usr/sbin/tcpd  proftpd         
Scusa l'ignoranza :).. ma è il primo che configuro :)

Codice: Seleziona tutto

bash-4.1# vsftpd 
500 OOPS: vsftpd: not configured for standalone, must be started from inetd
bash-4.1# /etc/inetd.conf 
stream: unable to open image `tcp':  @ error/blob.c/OpenBlob/2584.
stream: no decode delegate for this image format `tcp' @ error/constitute.c/ReadImage/532.
stream: unable to open image `nowait':  @ error/blob.c/OpenBlob/2584.
stream: no decode delegate for this image format `nowait' @ error/constitute.c/ReadImage/532.
stream: unable to open image `root':  @ error/blob.c/OpenBlob/2584.
stream: no decode delegate for this image format `root' @ error/constitute.c/ReadImage/532.
stream: missing an image filename `root' @ error/stream.c/StreamImageCommand/759.

real    0m0.036s
user    0m0.030s
sys     0m0.006s
/etc/inetd.conf: line 23: dgram: command not found

real    0m0.001s
user    0m0.001s
sys     0m0.000s
usage: ftp host-name [port]
ftp> 
Ora?

Avatar utente
conraid
Staff
Staff
Messaggi: 13631
Iscritto il: gio 14 lug 2005, 0:00
Nome Cognome: Corrado Franco
Slackware: current64
Desktop: kde
Località: Livorno
Contatta:

Re: Realizzare un server FTP o HTTP :)

Messaggio da conraid »

ehm... intanto o metti vsfptpd o proftpd
Scusa l'ignoranza :).. ma è il primo che configuro :)
io mai configurato a dire il vero, ma quel che fai esula dalla configurazione di un server ftp

Codice: Seleziona tutto

bash-4.1# vsftpd 
500 OOPS: vsftpd: not configured for standalone, must be started from inetd
bash-4.1# /etc/inetd.conf 
stream: unable to open image `tcp':  @ error/blob.c/OpenBlob/2584.
stream: no decode delegate for this image format `tcp' @ error/constitute.c/ReadImage/532.
stream: unable to open image `nowait':  @ error/blob.c/OpenBlob/2584.
stream: no decode delegate for this image format `nowait' @ error/constitute.c/ReadImage/532.
stream: unable to open image `root':  @ error/blob.c/OpenBlob/2584.
stream: no decode delegate for this image format `root' @ error/constitute.c/ReadImage/532.
stream: missing an image filename `root' @ error/stream.c/StreamImageCommand/759.

real    0m0.036s
user    0m0.030s
sys     0m0.006s
/etc/inetd.conf: line 23: dgram: command not found

real    0m0.001s
user    0m0.001s
sys     0m0.000s
usage: ftp host-name [port]
ftp> 

Ora?
stai provando ad eseguire un file di configurazione? :roll:

non devi fare nessuna delle due cose

1) sistema il file /etc/inetd.conf
2) rendi eseguibile il file /etc/rc.d/rc.inetd
3)

Codice: Seleziona tutto

/etc/rc.d/rc.inetd start
4) guardi se è tutto ok

p.s.
naturalmente configura bene anche il server ftp, ma su questo non so aiutarti

Avatar utente
zoros
Linux 4.x
Linux 4.x
Messaggi: 1362
Iscritto il: lun 28 mag 2007, 22:51
Nome Cognome: Fabio`Zorba`
Slackware: 15.0
Kernel: 5.15.19smp
Desktop: Trinity R14.0.11
Località: Gorizia

Re: Realizzare un server FTP o HTTP :)

Messaggio da zoros »

dipende anche da cosa voi fare ... io preferisco pure-ftp: http://www.pureftpd.org/project/pure-ftpd ... la versione che uso io non ha neanche un conf :) ...

qui un confronto: http://www.webhostingtalk.com/showthread.php?t=948898
vorrei riavere le mie firme ...

Avatar utente
darkstaring
Linux 3.x
Linux 3.x
Messaggi: 658
Iscritto il: mer 13 ott 2010, 13:55
Nome Cognome: Francesco Achenza
Desktop: KDE
Distribuzione: Arch Linux
Contatta:

Re: Realizzare un server FTP o HTTP :)

Messaggio da darkstaring »

Umh...
Per ora credo manchi molto ad arrivare ad una buona configurazione, intanto credo di dover bloccare tutte le porte non utili in uscita,
impostare un'accesso con nome utente e passwd e farlo partire :)...
Sembra un pò contorto far tutto senza guida, ora la cerco :)
linkate se ne conoscete qualcuna bella e buona :)..
Grazie :)

Avatar utente
zoros
Linux 4.x
Linux 4.x
Messaggi: 1362
Iscritto il: lun 28 mag 2007, 22:51
Nome Cognome: Fabio`Zorba`
Slackware: 15.0
Kernel: 5.15.19smp
Desktop: Trinity R14.0.11
Località: Gorizia

Re: Realizzare un server FTP o HTTP :)

Messaggio da zoros »

darkstaring ha scritto:...
Sembra un pò contorto far tutto senza guida, ora la cerco :)
linkate se ne conoscete qualcuna bella e buona :)..
Grazie :)
se ti va bene pure-ftp, io ho tutte le indicazioni necessarie per attivare un servizio funzionante ... però sono datate, mentre il progetto è più che mai attivo ... se ti interessa (guarda le prestazioni), posso inserire qui ciò che so e magari assieme possiamo testare il tutto sull'ultima Slack, così ne ricaviamo un articolo da inserire nel wiki ;) ...
vorrei riavere le mie firme ...

Avatar utente
darkstaring
Linux 3.x
Linux 3.x
Messaggi: 658
Iscritto il: mer 13 ott 2010, 13:55
Nome Cognome: Francesco Achenza
Desktop: KDE
Distribuzione: Arch Linux
Contatta:

Re: Realizzare un server FTP o HTTP :)

Messaggio da darkstaring »

zoros ha scritto: se ti va bene pure-ftp, io ho tutte le indicazioni necessarie per attivare un servizio funzionante ... però sono datate, mentre il progetto è più che mai attivo ... se ti interessa (guarda le prestazioni), posso inserire qui ciò che so e magari assieme possiamo testare il tutto sull'ultima Slack, così ne ricaviamo un articolo da inserire nel wiki ;) ...
Anche io vorrei scrivere una guida sulla configurazione etc, solo che vorrei usare gli strumenti che ha già slackware :).. non perchè non voglia installare pureftp, ma propio per usare gli strumenti che ho :).. A mè interessa più riuscire a farlo che averlo :)... sicuramente scriverò una guida..
Comunque prima ho fatto una gaff eseguendo il config, ero a lavoro e stavo facendo 1000 cose :)..
Comunque anche avviando inetd non funge

Codice: Seleziona tutto

/etc/rc.d/rc.inetd start
Starting Internet super-server daemon:  /usr/sbin/inetd

bash-4.1# vsftpd 
500 OOPS: vsftpd: not configured for standalone, must be started from inetd

#Se può servire
bash-4.1# netstat -putane | grep inetd    
tcp        0      0 0.0.0.0:113             0.0.0.0:*               LISTEN      0          5772       1917/inetd          
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      0          5770       1917/inetd          
tcp        0      0 0.0.0.0:37              0.0.0.0:*               LISTEN      0          5768       1917/inetd          
udp        0      0 0.0.0.0:512             0.0.0.0:*                           0          1302127    4223/inetd          
udp        0      0 0.0.0.0:512             0.0.0.0:*                           0          5771       1917/inetd          
udp        0      0 0.0.0.0:37              0.0.0.0:*                           0          1302125    4223/inetd          
udp        0      0 0.0.0.0:37              0.0.0.0:*                           0          5769       1917/inetd
Credo che inetd.conf sia configurato male..

Se invece abilito l'IPV4 dal config di vsftpd.conf
# When "listen" directive is enabled, vsftpd runs in standalone mode (rather
# than from inetd) and listens on IPv4 sockets. To use vsftpd in standalone
# mode rather than with inetd, change the line below to 'listen=YES'
# This directive cannot be used in conjunction with the listen_ipv6 directive.
listen=YES
ho:
bash-4.1# vsftpd
500 OOPS: could not bind listening IPv4 socket
zoros ha scritto: se ti interessa (guarda le prestazioni)
Cosa intendi per "guarda le prestazioni" ?

Avatar utente
zoros
Linux 4.x
Linux 4.x
Messaggi: 1362
Iscritto il: lun 28 mag 2007, 22:51
Nome Cognome: Fabio`Zorba`
Slackware: 15.0
Kernel: 5.15.19smp
Desktop: Trinity R14.0.11
Località: Gorizia

Re: Realizzare un server FTP o HTTP :)

Messaggio da zoros »

il secondo link che ho messo in precedenza mette a confronto proftp con pure-ftp ... stai appena imparando, quindi non ti interessa ... il resto del discorso era: dal tuo post mi è venuto in mente pure-ftp ... ho guardato i file di lavoro che ho, dentro c'è scritto 2005 :roll: ... poi ho guardato il link del progetto, l'ultima release è marzo 2011 ... progetto "vivo", quindi merita ...

tendenzialmente scarto le cose che sembrano complicate, pure-ftp è semplice e funziona ... solo che non mi metto adesso a testare l'ultima versione perché non ha uno scopo per me, adesso ... poteva esserlo se di aiuto ad altri ... a te interessa usare proftp e non è una cattiva idea ... a me pare dai log che posti che ci sei quasi, ma non so esattamente come aiutarti ;) ...
vorrei riavere le mie firme ...

Avatar utente
darkstaring
Linux 3.x
Linux 3.x
Messaggi: 658
Iscritto il: mer 13 ott 2010, 13:55
Nome Cognome: Francesco Achenza
Desktop: KDE
Distribuzione: Arch Linux
Contatta:

Re: Realizzare un server FTP o HTTP :)

Messaggio da darkstaring »

zoros ha scritto: ho guardato i file di lavoro che ho, dentro c'è scritto 2005 :roll: ...
poi ho guardato il link del progetto, l'ultima release è marzo 2011 ... progetto "vivo", quindi merita ...
tendenzialmente scarto le cose che sembrano complicate, pure-ftp è semplice e funziona
Io uso questa versione vsftpd-2.3.4 released.. è dì Feb 2011 :).. comunque non sò sè stia funzionando, ho letto varie guide ed ho configurato tutto corretamente
ma tra i processi non vedo vsftpd.. è normale?
se lancio ftp MIOIPLOCALE vedo la mia home directory...

Codice: Seleziona tutto

bash-4.1# ftp
ftp> open
(to) 192.168.1.80
Connected to 192.168.1.80.
220 Welcome to Francesco FTP service #COME HO IMPOSTATO SU VSFTPD.CONF
Name (192.168.1.80:francesco): 
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.
vuol dire che sta fungendo?
Se si, sapete come posso limitare lo spazio visibile con ftp a solo ed esclusivamete /home/ftp?..

Avatar utente
conraid
Staff
Staff
Messaggi: 13631
Iscritto il: gio 14 lug 2005, 0:00
Nome Cognome: Corrado Franco
Slackware: current64
Desktop: kde
Località: Livorno
Contatta:

Re: Realizzare un server FTP o HTTP :)

Messaggio da conraid »

Non devi lanciare inetd e poi vsftps, ci pensa inetd a lanciarlo. Devi "solamente" lanciare inetd (che poi parte da solo al boot se ha i permessi di esecuzione). Ma devi cambiare le impostazioni di inetd.conf perché quelle che avevi all'inizio lanciavano 2 server ftp

inoltre se cambi le impostazioni per lanciarlo standalone, disabilitalo via inetd, altrimenti la porta è già occupata

non per fare l'antipatico, ma prima di avventurarti nella configurazione e gestione di un server ftp non sarebbe meglio imparare quel che ci sta a monte?

Avatar utente
darkstaring
Linux 3.x
Linux 3.x
Messaggi: 658
Iscritto il: mer 13 ott 2010, 13:55
Nome Cognome: Francesco Achenza
Desktop: KDE
Distribuzione: Arch Linux
Contatta:

Re: Installare un server FTP

Messaggio da darkstaring »

Grazie, avevo già fatto quel che mi hai detto :)...
Ho disabilitato il LISTEN da vsftpd, ma è normale o no che lanciando ftp mioip veda la mia home?
Per uscire dalla lan, oltre ad abilitare le porte dal router come posso ottenere un ip pubblico fisso ?
thanks :)

Avatar utente
conraid
Staff
Staff
Messaggi: 13631
Iscritto il: gio 14 lug 2005, 0:00
Nome Cognome: Corrado Franco
Slackware: current64
Desktop: kde
Località: Livorno
Contatta:

Re: Installare un server FTP

Messaggio da conraid »

darkstaring ha scritto: Ho disabilitato il LISTEN da vsftpd, ma è normale o no che lanciando ftp mioip veda la mia home?
dipende da come lo hai configurato
darkstaring ha scritto: Per uscire dalla lan, oltre ad abilitare le porte dal router come posso ottenere un ip pubblico fisso ?
prima di fare una cosa simile imparerei "bene" il tutto. Rischi di trovarti un server esposto inutilmente.
Per l'ip "fisso" dipende. Alcuni provider te lo danno di default, altri pagando, altri ancora solo se fai un contratto di diverso tipo (quelli "home" difficilmente ce l'hanno)

Avatar utente
darkstaring
Linux 3.x
Linux 3.x
Messaggi: 658
Iscritto il: mer 13 ott 2010, 13:55
Nome Cognome: Francesco Achenza
Desktop: KDE
Distribuzione: Arch Linux
Contatta:

Re: Installare un server FTP

Messaggio da darkstaring »

hai ragione, prima configuro tutto al meglio... questo è il config di vsftpd

Codice: Seleziona tutto

local_enable=YES
local_umask=022

anonymous_enable=NO
chroot_local_user=YES
passwd_chroot_enable=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list

ls_recurse_enable=YES
ftpd_banner=Welcome to Francesco FTP service
dirmessage_enable=YES
write_enable=YES

xferlog_enable=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
Non riesco ad accedere dalla directory /home/ftp, ho creato un'utente per questo scopo

Codice: Seleziona tutto

bash-4.1# useradd -d /home/ftp/ -s /dev/null utenteftp
bash-4.1# passwd utenteftp
ma se entro nell'ftp con quel nome utente, non mi fà entrare

Codice: Seleziona tutto

530 Login incorrect.
Login failed.
Mentre se mi loggo con un'account con shell di login "attiva" es. /bin/bash ecc allora funziona, ma ho letto che bisogna usare propio una shell di /sbin/nologin o /dev/null...
In questi articoli
http://www.programmazione.it/index.php? ... Item=36976
e
http://it.narkive.com/2010/7/22/5906703 ... -conf.html

Meskalamdug
Iper Master
Iper Master
Messaggi: 3965
Iscritto il: ven 14 mag 2004, 0:00

Re: Installare un server FTP

Messaggio da Meskalamdug »

Anche io ti consiglio pure-ftpd,oltre a essere semplice
ha anche la possibilità di usare mysql per gli utenti
e ssl per la cifratura.

Rispondi