pure-ftpd on Ubuntu (14.04 in my case) doesn't use a single configuration file for the settings. Instead there is a wrapper script which reads each parameter from separate config files. This is kind of documented here: https://help.ubuntu.com/community/PureFTP. However I couldn't find any hint how to activate a global banner or login message to display when a FTP user logs in. Sure, there's the .banner file in the ftp user's home directory. The official doc says:
------------------------ DISPLAYING BANNERS ------------------------
If a '.banner' file is located in the 'ftp' user home directory (or in the
root directory of a virtual server, see below), it will be printed when the
client logs in. Put a nice ASCII-art logo with your name in that file.
This file shouldn't be larger than 4000 bytes, or it won't be displayed.
In each directory, you may also have a '.message' file. Its content will be
printed when a client enters the directory. Such a file can contain important
information ("Don't download version 1.7, it's broken!") .
But I want to do a general banner for everyone and don't want to symlink a .banner every time a new FTP user is created.
There is the possibility however, to load a global banner with the -F flag. It's not called banner or message but Fortune Cookie File:
A funny random message can be displayed in the initial login banner. The
random cookies are extracted from a text file, in the standard "fortune"
format. If you installed the "fortune" package, you should have a directory
(usually /usr/share/fortune) with binary files (xxxx.dat) and text files
(without the .dat extension) . To use Pure-FTPd cookies, just add the name
of a text file to the '-F' option. For instance:
/usr/local/sbin/pure-ftpd -F /usr/share/fortune/zippy
But how does one tell pure-ftpd to use this flag now? The answer is in the wrapper script (/usr/sbin/pure-ftpd-wrapper):
$ cat /usr/sbin/pure-ftpd-wrapper
my %conf = ('AllowAnonymousFXP' => ['-W'],
'AllowDotFiles' => ['-z'],
'FortunesFile' => ['-F %s', \&parse_filename],
'FSCharset' => ['-8 %s', \&parse_string],
As you can see, the wrapper script is already prepared for a separate config file called "FortunesFile". The correct file name must be used, or it won't work.
So I created this FortunesFile with the path to the file containing th eactual banner message:
# echo "/etc/pure-ftpd/Banner.txt" > /etc/pure-ftpd/conf/FortunesFile
And in the banner file itself, I added the wanted general information:
$ cat /etc/pure-ftpd/Banner.txt
This FTP server is read only. And private, too.
Files older than 30 days will be automatically deleted!
A restart of pure-ftpd confirmed that the -F flag was now being used:
# /etc/init.d/pure-ftpd restart
Restarting ftp server: Running: /usr/sbin/pure-ftpd -l puredb:/etc/pure-ftpd/pureftpd.pdb -l pam -A -O clf:/var/log/pure-ftpd/transfer.log -F /etc/pure-ftpd/Banner.txt -p 20000:20500 -u 1000 -8 UTF-8 -d -Y 1 -E -U 117:007 -B
And in an FTP client (here FileZilla), the message is now shown:
No comments yet.
Personal Internet VMware PHP Linux Shell Bluecoat Proxy Windows Hardware Virtualization Nagios MySQL DB Monitoring Mail Android Network Wyse Hacks Tomcat Postgres Apple Mac Backup BSD ZFS Solaris SmartOS Unix Multimedia Perl Database MongoDB CMS OTRS FreeBSD Wordpress LXC Nginx Proxmox DNS Graphics GlusterFS Security Chef HAProxy Icinga Ansible HTML MariaDB Containers Rancher Docker AWS ELK Kibana Logstash Filebeat Varnish PGSQL PostgreSQL ElasticSearch CouchDB Bash Macintosh Container Minio Grafana InfluxDB Databases NFS OSSEC SystemD Java Zoneminder Surveillance Elasticsearch SSL TLS Icingaweb2 Cloud Wireless Kubernetes Ubuntu