-
Notifications
You must be signed in to change notification settings - Fork 51
Virtual FTP Server on Ubuntu 10.04 (Lucid Lynx)
This document assumes a standard Bricolage installation on Ubuntu. If you’ve configured Bricolage with local::lib and a different user, as per Installing Bricolage 2.0.1 on Ubuntu 10.04 LTS (Lucid Lynx), then you’ll need to adjust the user name, group and bric_ftpd
paths accordingly.
For example:
User: bric201
Group: bric201
Path: /usr/local/sbin/bricolage/2.0.1/bric_ftpd
Instead of:
User: www-data
Group: www-data
Path: /usr/local/bricolage/bin/bric_ftpd
Edit bricolage.conf
:
sudo vim /usr/local/bricolage/conf/bricolage.conf
# ENABLE_FTP_SERVER = No
ENABLE_FTP_SERVER = Yes
The Virtual FTP Server should be run as the same user that runs the Bricolage Apache process.
You’ll probably need to change some permissions to allow www-data
to read the Bricolage configuration:
sudo chown -R root:www-data /usr/local/bricolage/conf
Start:
sudo -u www-data /usr/local/bricolage/bin/bric_ftpd -S
Stop:
sudo -u www-data /usr/local/bricolage/bin/bric_ftpd -k
It should be possible to browse for and open files using the standard Vim edit and open commands:
:e ftp://admin@bricolage\#2121/
Note: I have been able to connect to the virtual FTP server in Ubuntu desktop (11.04) through Places → Connect to server…. From there, I can browse files in the Nautilus file browser, and open them in GVim via Nautilus. However, attempting to open the files directly from Vim or GVim using the open command (as shown above) has not been quite so successful.
The top level site directory is shown, but I am unable to descend into it. Instead, I receive the following errors:
ftp: connect: Connection refused
Not connected.
Not connected.
Any updates to this section would therefore be appreciated :) See Virtual FTP Server with Vim for more information.
You can open and edit files directly on an FTP server using Vim.
If Vim attempts to create .swp
files in the same directory as the template, this causes errors to appear in the log/ftp.log
file. A simple solution is to tell Vim to store the swap files somewhere else:
Append to the end of ~/.vimrc
:
" Change the .swp file location
set directory=/tmp
If there’s a suitable .netrc
file in your home directory, Vim will use it to supply your username and password to the FTP server:
Create ~/.netrc
:
machine bric.mikeraynham.co.uk
login admin
password "change me now!"
Lock down the permissions:
chmod 0600 ~/.netrc
If you are using Template::Toolkit, you might want to enable TT syntax highlighting in Vim. One way to do this is to install the vim-perl support files, which includes syntax highlighting for TT2.
Download, extract and install the syntax files:
wget -O vim-perl.tar.gz https://github.com/petdance/vim-perl/tarball/master/
tar xvfz vim-perl.tar.gz
cd petdance-vim-perl-23483b7/
make install
To enable automatic syntax detection, add the following lines to the end of filetype.vim
.
Note: vim73
may need changing if you have a different version of Vim.
sudo vim /usr/share/vim/vim73/filetype.vim
" TT2 - Template Toolkit
au BufNewFile,BufRead *.tt,*.tt2
\ if getline(1) . getline(2) . getline(3) =~ '\c<!DOCTYPE html' ||
\ getline(1) . getline(2) . getline(3) =~ '\c<html'
\| setf tt2html
\| else
\| setf tt2
\| endif