I'm trying to build a shell script to automate the installation of several packages onto an Ubuntu 10.04 server, and I'm having problems with proftpd-basic.

I'm using the command line

apt-get -qy install proftpd-basic >/tmp/install.log

For most packages, this approach would work fine, however proftpd-basic appears to require some interaction (it asks whether to perform an inetd or standalone installation).

Is it possible for me to pre-select this option on the command line somehow, as I don't want the user to be bothered by this question? - For info, if it matters, I want to choose the 'standalone' option.


The interactive part of the process doesn't just require simple y/n answers, it requires that I use arrow keys to navigate to the option I want, requiring me to press enter to make the selection. This might have some bearing upon the solution to this problem.


You can "preseed" answers so that debconf sees you've answered the question already, and doesn't bother asking it again.

You need some tools from the debconf-utils package:

sudo apt-get install debconf-utils

Install your program and manually answer the questions once. Then, you can ask debconf what it stored in its database:

debconf-get-selections | grep proftpd-basic

That information can be input into debconf-set-selections (either by piping, or reading from a file).

Warner's answer is more cross-platform (debconf is a Debian-and-derivates only technology), but doesn't always work between versions, if the questions change; or in the case you have some debconf questions that are only asked if you have other packages installed.


There's a variety of different solutions for things like this. I prefer shell scripting, others might prefer other methods.

For interaction with things that require input and don't have flags to specify the answer, you can redirect input. I would read the apt-get manpage before taking this approach, as it may have native support for what you are trying to specify. For example:

apt-get -qy install proftpd-basic <<**

You could also use something like expect. Some clients do not always handle input redirection without additional effort.

For logging, you can use tee and redirect STDERR and STDOUT when running the main script. Example:

bash -x script.sh 2>&1 | tee script.log

I often like to run bash with set -x as well. For build scripts, I prefer verbosity over cleaner output.

  • Thanks, +1 as I've learned two new useful shell scripting commands there, but (see the edit to my question), I'll have to accept crb's answer, as it works perfectly. – Bryan May 3 '10 at 16:47
  • I appreciate the consideration! =) crb's answer definitely seems best suited for your situation. I gave him a +1 myself. – Warner May 3 '10 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.