Monthly Archives: February 2012

Building an Ubuntu 11.10 Oneiric Server

So I wanted to rebuild my ubuntu desktop acting as a server as a true headless server.  First I downloaded the latest ubuntu.com and created the image on a USB stick following the instructions from (http://www.ubuntu.com/download/server/download):

We would encourage Mac users to download Ubuntu Desktop Edition by burning a CD for the time being. But if you would prefer to use a USB, please follow the instructions below.

Note: this procedure requires an .img file that you will be required to create from the .iso file you download.

TIP: Drag and Drop a file from Finder to Terminal to ‘paste’ the full path without typing and risking type errors.

  1. Download the desired file
  2. Open the Terminal (in /Applications/Utilities/ or query Terminal in Spotlight)
  3. Convert the .iso file to .img using the convert option of hdiutil (e.g.,hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso)
  4. Note: OS X tends to put the .dmg ending on the output file automatically.
  5. Run diskutil list to get the current list of devices
  6. Insert your flash media
  7. Run diskutil list again and determine the device node assigned to your flash media (e.g. /dev/disk2)
  8. Run diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command; in the previous example, N would be 2)
  9. Execute sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m (replace /path/to/downloaded.img with the path where the image file is located; for example,./ubuntu.img or ./ubuntu.dmg).
    • Using /dev/rdisk instead of /dev/disk may be faster.
    • If you see the error dd: Invalid number '1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M.
    • If you see the error dd: /dev/diskN: Resource busy, make sure the disk is not in use. Start the ‘Disk Utility.app’ and unmount (don’t eject) the drive.
  10. Run diskutil eject /dev/diskN and remove your flash media when the command completes
  11. Restart your Mac and press alt while the Mac is restarting to choose the USB-Stick

Once Rebooted and running (install took about 15 minutes), the first thing was to get logged in and run an update

apt-get update

and

apt-get upgrade (this part takes a while)

 

Automatic Updates

The unattended-upgrades package can be used to automatically install updated packages, and can be configured to update all packages or just install security updates. First, install the package by entering the following in a terminal:

sudo apt-get install unattended-upgrades

To configure unattended-upgrades, edit /etc/apt/apt.conf.d/50unattended-upgrades and adjust the following to fit your needs:

Unattended-Upgrade::Allowed-Origins {
        "Ubuntu oneiric-security";
//      "Ubuntu oneiric-updates";
};

Certain packages can also be blacklisted and therefore will not be automatically updated. To blacklist a package, add it to the list:

Unattended-Upgrade::Package-Blacklist {
//  "vim";
//  "libc6";
//       "libc6-dev";
//       "libc6-i686";
};

The double “//” serve as comments, so whatever follows “//” will not be evaluated.

To enable automatic updates, edit /etc/apt/apt.conf.d/10periodic and set the appropriate apt configuration options:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";

The above configuration updates the package list, downloads, and installs available upgrades every day. The local download archive is cleaned every week.

You can read more about apt Periodic configuration options in the/etc/cron.daily/apt script header.

The results of unattended-upgrades will be logged to /var/log/unattended-upgrades.

 

Upgrade Notifications

Configuring Unattended-Upgrade::Mail in /etc/apt/apt.conf.d/50unattended-upgrades will enable unattended-upgrades to email an administrator detailing any packages that need upgrading or have problems.

Another useful package is apticron. apticron will configure a cron job to email an administrator information about any packages on the system that have updates available, as well as a summary of changes in each package.

To install the apticron package, in a terminal enter:

sudo apt-get install apticron

Once the package is installed edit /etc/apticron/apticron.conf, to set the email address and other options:

EMAIL="root@example.com"

 

Adjusting Sources for APT

By default, the Universe and Multiverse repositories are enabled but if you would like to disable them edit /etc/apt/sources.list and comment the following lines:

deb http://archive.ubuntu.com/ubuntu oneiric universe multiverse
deb-src http://archive.ubuntu.com/ubuntu oneiric universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe
deb-src http://us.archive.ubuntu.com/ubuntu/ oneiric universe
deb http://us.archive.ubuntu.com/ubuntu/ oneiric-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ oneiric-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ oneiric multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ oneiric multiverse
deb http://us.archive.ubuntu.com/ubuntu/ oneiric-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ oneiric-updates multiverse
deb http://security.ubuntu.com/ubuntu oneiric-security universe
deb-src http://security.ubuntu.com/ubuntu oneiric-security universe
deb http://security.ubuntu.com/ubuntu oneiric-security multiverse
deb-src http://security.ubuntu.com/ubuntu oneiric-security multiverse

I commented all of the above out.

Networking

lshw -class network
*-network
description: Ethernet interface
product: 82566DM-2 Gigabit Network Connection
vendor: Intel Corporation
physical id: 19
bus info: pci@0000:00:19.0
logical name: eth0
version: 02
serial: 00:1a:a0:e8:f6:40
size: 1Gbit/s
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=1.3.10-k2 duplex=full firmware=1.1-1 ip=192.168.1.151 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
resources: irq:42 memory:fe9e0000-fe9fffff memory:fe9db000-fe9dbfff ioport:ecc0(size=32)

Ethernet Interface Settings

ethtool is a program that displays and changes Ethernet card settings such as auto-negotiation, port speed, duplex mode, and Wake-on-LAN. It is not installed by default, but is available for installation in the repositories.

sudo apt-get install ethtool

The following is an example of how to view supported features and configured settings of an Ethernet interface.

sudo ethtool eth0
Settings for eth0:
        Supported ports: [ TP ]
        Supported link modes:
10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: d
        Current message level: 0x000000ff (255)
        Link detected: yes

Changes made with the ethtool command are temporary and will be lost after a reboot. If you would like to retain settings, simply add the desired ethtool command to a pre-up statement in the interface configuration file /etc/network/interfaces.

The following is an example of how the interface identified as eth0 could be permanently configured with a port speed of 1000Mb/s running in full duplex mode.

auto eth0
iface eth0 inet static
pre-up /sbin/ethtool -s eth0 speed 1000 duplex full

Although the example above shows the interface configured to use the static method, it actually works with other methods as well, such as DHCP. The example is meant to demonstrate only proper placement of the pre-up statement in relation to the rest of the interface configuration.

 

Want to set up a static interface so in /etc/network/interfaces:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.4
netmask 255.255.255.0
network 192.168.1.1
broadcast 192.168.1.255
gateway 192.168.1.1

Airvideo Server

Let’s do something fun…   set up airvideo-server:

before we get started there are a few other packages to get:

apt-get install apt-get install python-software-properties

Update 2011/12/05 Oneiric packages now available

  1. Open a Terminal
  2. Add the AirVideo PPA repositorysudo add-apt-repository ppa:rubiojr/airvideo
  3. Update package indexsudo apt-get update
  4. Install AirVideo Serversudo apt-get install airvideo-server
  5. Tweak the ‘folders’ property editing /opt/airvideo-server/AirVideoServerLinux.properties
  6. Open the Air Video server application or type ‘airvideo-server’ in a terminal
  7. Enjoy

References:

http://inmethod.com/air-video/index.html

http://wiki.birth-online.de/know-how/hardware/apple-iphone/airvideo-server-linux

http://www.inmethod.com/forum/posts/list/1856.page

https://launchpad.net/~rubiojr/+archive/airvideo

 

Auto starting Air Video on Startup

Create /etc/init/airvideo.conf:

start on runlevel [2345]
stop on shutdown
respawn

exec sudo -H -n -u root /usr/bin/java -jar /opt/airvideo-server/AirVideoServerLinux.jar /opt/airvideo-server/AirVideoServerLinux.properties

This will tell UpStart to run the server process as user mbirth upon reaching one of the runlevels 2-5 and stop the server when the system shuts down. respawn tells it to restart the server if it crashed.

You can also control it manually by doing

sudo start airvideo

or

sudo stop airvideo

Avahi Configuration for AirVideo

To get airvideo over Bonjour for iPads, Macs, iTunes, etc. need to configure avahi-daemon for airvideo
In /etc/avahi/services, add to/create multi.service:
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_smb._tcp</type>
<port>139</port>
</service>
<service>
<type>_rfb._tcp</type>
<port>5901</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=RackMac</txt-record>
</service>
<service>
<type>_http._tcp</type>
<port>80</port>
</service>
<service>
<type>_ssh._tcp</type>
<port>22</port>
</service>
<service>
<type>_sftp-ssh._tcp</type>
<port>22</port>
</service>
</service-group>
<service-group>
<name replace-wildcards="yes">AirVideoServer on %h</name>
<service>
<type>_airvideoserver._tcp</type>
<port>45631</port>
</service>
</service-group>

 

XFS

Adding support for XFS is another installation:

apt-get install xfsprogs

then the xfs mount points can be added to /etc/fstab

 

Mail

apt-get install bsd-mailx

so we can email from the command line!

 

NTP

NTP is a TCP/IP protocol for synchronising time over a network. Basically a client requests the current time from a server, and uses it to set its own clock.

Behind this simple description, there is a lot of complexity – there are tiers of NTP servers, with the tier one NTP servers connected to atomic clocks, and tier two and three servers spreading the load
of actually handling requests across the Internet. Also the client software is a lot more complex than you might think – it has to factor out communication delays, and adjust the time in a way that does not upset all the other processes that run on the server. But luckily all that complexity is hidden from you!

Ubuntu uses ntpdate and ntpd.

4.1. ntpdate

Ubuntu comes with ntpdate as standard, and will run it once at boot time to set up your time according to Ubuntu’s NTP server.

ntpdate -s ntp.ubuntu.com

4.2. ntpd

The ntp daemon ntpd calculates the drift of your system clock and continuously adjusts it, so there are no large corrections that could lead to inconsistent logs for instance. The cost is a little processing power and memory, but for a modern server this is negligible.

4.3. Installation
To install ntpd, from a terminal prompt enter:

sudo apt-get install ntp

4.4. Configuration
Edit /etc/ntp.conf to add/remove server lines. By default these servers are configured:

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org

After changing the config file you have to reload the ntpd:

sudo /etc/init.d/ntp reload

View status

Use ntpq to see to see more info:

# sudo ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+stratum2-2.NTP. 129.70.130.70    2 u    5   64  377   68.461  -44.274 110.334
+ntp2.m-online.n 212.18.1.106     2 u    5   64  377   54.629  -27.318  78.882
*145.253.66.170  .DCFa.           1 u   10   64  377   83.607  -30.159  68.343
+stratum2-3.NTP. 129.70.130.70    2 u    5   64  357   68.795  -68.168 104.612
+europium.canoni 193.79.237.14    2 u   63   64  337   81.534  -67.968  92.792

References

  • See the Ubuntu Time15 wiki page for more information.
  • ntp.org, home of the Network Time Protocol project16

Puppet

Puppet is a cross platform framework enabling system administrators to perform common tasks using code. The code can do a variety of tasks from installing new software, to checking file permissions, or updating user accounts. Puppet is great not only during the initial installation of a system, but also throughout the system’s entire life cycle. In most circumstances puppet will be used in a client/server configuration.

This section will cover installing and configuring Puppet in a client/server configuration. This simple example will demonstrate how to install Apache using Puppet.

Installation

To install Puppet, in a terminal on the server enter: sudo apt-get install puppetmaster

On the client machine, or machines, enter: sudo apt-get install puppet

Configuration

Prior to configuring puppet you may want to add a DNS CNAME record for puppet.example.com, where example.com is your domain. By default Puppet clients check DNS for puppet.example.com as the puppet server name, or Puppet Master. See Chapter 7, Domain Name Service (DNS) [p. 97]
for more DNS details.

If you do not wish to use DNS, you can add entries to the server and client /etc/hosts file. For example, in the Puppet server’s /etc/hosts file add:

127.0.0.1 localhost.localdomain localhost puppet
192.168.1.17 meercat02.example.com meercat02

On each Puppet client, add an entry for the server:

192.168.1.16 meercat.example.com meercat puppet

Replace the example IP addresses and domain names above with your actual server and client addresses and domain names.

Now setup some resources for apache2. Create a file /etc/puppet/manifests/site.pp containing the following:

 package {
    'apache2':
        ensure => installed
}
service {
    'apache2':
        ensure => true,
        enable => true,
        require => Package['apache2']
}
 Next, create a node file /etc/puppet/manifests/nodes.pp with:
node 'meercat02.example.com' {
   include apache2

}

Replace meercat02.example.com with your actual Puppet client’s host name.

The final step for this simple Puppet server is to restart the daemon:

sudo /etc/init.d/puppetmaster restart

Now everything is configured on the Puppet server, it is time to configure the client.
First, configure the Puppetagent daemon to start. Edit /etc/default/puppet, changing START to yes:

START=yes

Then start the service:

sudo /etc/init.d/puppet start

Back on the Puppet server sign the client certificate by entering:

sudo puppetca --sign meercat02.example.com

Check /var/log/syslog for any errors with the configuration. If all goes well the apache2 package and it’s dependencies will be installed on the Puppet client.

This example is very simple, and does not highlight many of Puppet’s features and benefits.

  • Also see Pro Puppet5.
  • Another source of additional information is the Ubuntu Wiki Puppet Page6.

 

phpMyAdmin

phpMyAdmin is a LAMP application specifically written for administering MySQL servers. Written in PHP, and accessed through a web browser, phpMyAdmin provides a graphical interface for database administration tasks.

Installation

Before installing phpMyAdmin you will need access to a MySQL database either on the same host as that phpMyAdmin is installed on, or on a host accessible over the network. For more information see Section 1, “MySQL” [p. 162]. From a terminal prompt enter:

sudo apt-get install phpmyadmin

At the prompt choose which web server to be configured for phpMyAdmin. The rest of this section will use Apache2 for the web server.

In a browser go to http://servername/phpmyadmin, replacing serveranme with the server’s actual hostname. At the login, page enter root for the username, or another MySQL user if you any setup, and enter the MySQL user’s password.

Once logged in you can reset the root password if needed, create users, create/destroy databases and tables, etc.

Configuration

The configuration files for phpMyAdmin are located in /etc/phpmyadmin. The main configuration file is /etc/phpmyadmin/config.inc.php. This file contains configuration options that apply globally to phpMyAdmin.

To use phpMyAdmin to administer a MySQL database hosted on another server, adjust the following in /etc/phpmyadmin/config.inc.php:

$cfg['Servers'][$i]['host'] = 'db_server';

Replace db_server with the actual remote database server name or IP address. Also, be sure that the phpMyAdmin host has permissions to access the remote database.

Once configured, log out of phpMyAdmin and back in, and you should be accessing the new server.

The config.header.inc.php and config.footer.inc.php files are used to add a HTML header and footer to phpMyAdmin.

Another important configuration file is /etc/phpmyadmin/apache.conf, this file is symlinked to / etc/apache2/conf.d/phpmyadmin.conf, and is used to configure Apache2 to serve the phpMyAdmin site. The file contains directives for loading PHP, directory permissions, etc. For more information on configuring Apache2 see Section 1, “HTTPD – Apache2 Web Server”.

References

  • The phpMyAdmin documentation comes installed with the package and can be accessed from the phpMyAdmin Documentation link (a question mark with a box around it) under the phpMyAdmin logo. The official docs can also be access on the phpMyAdmin7 site.
  • Also, Mastering phpMyAdmin8 is a great resource.
  • A third resource is the phpMyAdmin Ubuntu Wiki9 page.

 

 

FTP Server

File Transfer Protocol (FTP) is a TCP protocol for uploading and downloading files between computers. FTP works on a client/server model. The server component is called an FTP daemon. It continuously listens for FTP requests from remote clients. When a request is received, it manages the login and sets up the connection. For the duration of the session it executes any of commands sent by the FTP client.

Access to an FTP server can be managed in two ways:

• Anonymous
• Authenticated

In the Anonymous mode, remote clients can access the FTP server by using the default user account called “anonymous” or “ftp” and sending an email address as the password. In the Authenticated mode a user must have an account and a password. User access to the FTP server directories and files is dependent on the permissions defined for the account used at login. As a general rule, the FTP daemon will hide the root directory of the FTP server and change it to the FTP Home directory. This hides the rest of the file system from remote sessions.

 

vsftpd – FTP Server Installation

vsftpd is an FTP daemon available in Ubuntu. It is easy to install, set up, and maintain. To install vsftpd you can run the following command:

sudo apt-get install vsftpd

Anonymous FTP Configuration
By default vsftpd is not configured to allow anonymous download. If you wish to enable anonymous

download edit /etc/vsftpd.conf by changing: anonymous_enable=Yes

During installation a ftp user is created with a home directory of /srv/ftp. This is the default FTP directory.

If you wish to change this location, to /srv/files/ftp for example, simply create a directory in another location and change the ftp user’s home directory:

sudo mkdir /srv/files/ftp
sudo usermod -d /srv/files/ftp ftp

After making the change restart vsftpd:

sudo restart vsftpd

Finally, copy any files and directories you would like to make available through anonymous FTP to / srv/files/ftp, or /srv/ftp if you wish to use the default.

User Authenticated FTP Configuration

By default vsftpd is configured to authenticate system users and allow them to download files. If you want users to be able to upload files, edit /etc/vsftpd.conf:

write_enable=YES

Now restart vsftpd:

sudo restart vsftpd

Now when system users login to FTP they will start in their home directories where they can download, upload, create directories, etc.

Similarly, by default, anonymous users are not allowed to upload files to FTP server. To change this setting, you should uncomment the following line, and restart vsftpd:

anon_upload_enable=YES

Enabling anonymous FTP upload can be an extreme security risk. It is best to not enable anonymous upload on servers accessed directly from the Internet.

The configuration file consists of many configuration parameters. The information about each parameter is available in the configuration file. Alternatively, you can refer to the man page, man 5 vsftpd.conf for details of each parameter.

Securing FTP

There are options in /etc/vsftpd.conf to help make vsftpd more secure. For example users can be limited to their home directories by uncommenting:

chroot_local_user=YES

You can also limit a specific list of users to just their home directories:

chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list

After uncommenting the above options, create a /etc/vsftpd.chroot_list containing a list of users one per line. Then restart vsftpd:

sudo restart vsftpd

Also, the /etc/ftpusers file is a list of users that are disallowed FTP access. The default list includes root, daemon, nobody, etc. To disable FTP access for additional users simply add them to the list.

FTP can also be encrypted using FTPS. Different from SFTP, FTPS is FTP over Secure Socket Layer (SSL). SFTP is a FTP like session over an encrypted SSH connection. A major difference is that users of SFTP need to have a shell account on the system, instead of a nologin shell. Providing all users with a shell may not be ideal for some environments, such as a shared web host.

To configure FTPS, edit /etc/vsftpd.conf and at the bottom add: ssl_enable=Yes

Also, notice the certificate and key related options:

rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

By default these options are set the certificate and key provided by the ssl-cert package. In a production environment these should be replaced with a certificate and key generated for the specific host. For more information on certificates see Section 5, “Certificates” [p. 128].

Now restart vsftpd, and non-anonymous users will be forced to use FTPS: sudo restart vsftpd

To allow users with a shell of /usr/sbin/nologin access to FTP, but have no shell access, edit /etc/ shells adding the nologin shell:

# /etc/shells: valid login shells
/bin/csh
/bin/sh
/usr/bin/es
/usr/bin/ksh
/bin/ksh
/usr/bin/rc
/usr/bin/tcsh
/bin/tcsh
/usr/bin/esh
/bin/dash
/bin/bash
/bin/rbash
/usr/bin/screen
/usr/sbin/nologin

This is necessary because, by default vsftpd uses PAM for authentication, and the/etc/pam.d/ vsftpd configuration file contains:

auth required pam_shells.so TheshellsPAMmodulerestrictsaccesstoshellslistedinthe/etc/shellsfile.

Most popular FTP clients can be configured connect using FTPS. The lftp command line FTP client has the ability to use FTPS as well.

References

  • See the vsftpd website1 for more information.
  • For detailed /etc/vsftpd.conf options see the vsftpd.conf man page2.• The CodeGurus article FTPS vs. SFTP: What to Choose3 has useful information contrasting FTPS and SFTP.

 

CUPS – Print Server

The primary mechanism for Ubuntu printing and print services is the Common UNIX Printing System (CUPS). This printing system is a freely available, portable printing layer which has become the new standard for printing in most Linux distributions.

CUPS manages print jobs and queues and provides network printing using the standard Internet Printing Protocol (IPP), while offering support for a very large range of printers, from dot-matrix
to laser and many in between. CUPS also supports PostScript Printer Description (PPD) and auto- detection of network printers, and features a simple web-based configuration and administration tool.

Installation

To install CUPS on your Ubuntu computer, simply use sudo with the apt-get command and give the packages to install as the first parameter. A complete CUPS install has many package dependencies, but they may all be specified on the same command line. Enter the following at a terminal prompt to install CUPS:

sudo apt-get install cups

Upon authenticating with your user password, the packages should be downloaded and installed without error. Upon the conclusion of installation, the CUPS server will be started automatically.

For troubleshooting purposes, you can access CUPS server errors via the error log file at: /var/log/ cups/error_log. If the error log does not show enough information to troubleshoot any problems you encounter, the verbosity of the CUPS log can be increased by changing the LogLevel directive in the configuration file (discussed below) to “debug” or even “debug2”, which logs everything, from the default of “info”. If you make this change, remember to change it back once you’ve solved your problem, to prevent the log file from becoming overly large.

Configuration

The Common UNIX Printing System server’s behavior is configured through the directives contained in the file /etc/cups/cupsd.conf. The CUPS configuration file follows the same syntax as the primary configuration file for the Apache HTTP server, so users familiar with editing Apache’s configuration file should feel at ease when editing the CUPS configuration file. Some examples of settings you may wish to change initially will be presented here.

Prior to editing the configuration file, you should make a copy of the original file and protect it from writing, so you will have the original settings as a reference, and to reuse as necessary.

Copy the /etc/cups/cupsd.conf file and protect it from writing with the following commands, issued at a terminal prompt:

sudo cp /etc/cups/cupsd.conf /etc/cups/cupsd.conf.original
sudo chmod a-w /etc/cups/cupsd.conf.original
  • ServerAdmin: To configure the email address of the designated administrator of the CUPS server, simply edit the /etc/cups/cupsd.conf configuration file with your preferred text editor, and
    add or modify the ServerAdmin line accordingly. For example, if you are the Administrator for
    the CUPS server, and your e-mail address is ‘bjoy@somebigco.com’, then you would modify the ServerAdmin line to appear as such:

      ServerAdmin bjoy@somebigco.com
  • Listen: By default on Ubuntu, the CUPS server installation listens only on the loopback interface at IP address 127.0.0.1. In order to instruct the CUPS server to listen on an actual network adapter’s IP address, you must specify either a hostname, the IP address, or optionally, an IP address/port pairing via the addition of a Listen directive. For example, if your CUPS server resides on a local network at the IP address 192.168.10.250 and you’d like to make it accessible to the other systems on this subnetwork, you would edit the /etc/cups/cupsd.conf and add a Listen directive, as such:
      Listen 127.0.0.1:631           # existing loopback Listen
      Listen /var/run/cups/cups.sock # existing socket Listen
      Listen 192.168.10.250:631      # Listen on the LAN interface, Port 631 (IPP)

    In the example above, you may comment out or remove the reference to the Loopback address (127.0.0.1) if you do not wish cupsd to listen on that interface, but would rather have it only listen on the Ethernet interfaces of the Local Area Network (LAN). To enable listening for all network interfaces for which a certain hostname is bound, including the Loopback, you could create a Listen entry for the hostname socrates as such:

      Listen socrates:631  # Listen on all interfaces for the hostname 'socrates'

    or by omitting the Listen directive and using Port instead, as in: Port 631 # Listen on port 631 on all interfaces

    For more examples of configuration directives in the CUPS server configuration file, view the associated system manual page by entering the following command at a terminal prompt:

    man cupsd.conf

    Whenever you make changes to the /etc/cups/cupsd.conf configuration file, you’ll need to restart the CUPS server by typing the following command at a terminal prompt:

    sudo /etc/init.d/cups restart

Web Interface

CUPS can be configured and monitored using a web interface, which by default is available at http://localhost:631/admin. The web interface can be used to perform all printer management tasks.

In order to perform administrative tasks via the web interface, you must either have the root account enabled on your server, or authenticate as a user in the lpadmin group. For security reasons, CUPS won’t authenticate a user that doesn’t have a password.

To add a user to the lpadmin group, run at the terminal prompt: sudo usermod -aG lpadmin username

Further documentation is available in the Documentation/Help tab of the web interface.

References

CUPS Website
Debian Open-iSCSI page

 

Email Services

The process of getting an email from one person to another over a network or the Internet involves many systems working together. Each of these systems must be correctly configured for the process to work. The sender uses a Mail User Agent (MUA), or email client, to send the message through one or more Mail Transfer Agents (MTA), the last of which will hand it off to a Mail Delivery Agent (MDA) for delivery to the recipient’s mailbox, from which it will be retrieved by the recipient’s email client, usually via a POP3 or IMAP server.

Postfix

Postfix is the default Mail Transfer Agent (MTA) in Ubuntu. It attempts to be fast and easy to administer and secure. It is compatible with the MTA sendmail. This section explains how to install and configure postfix. It also explains how to set it up as an SMTP server using a secure connection (for sending emails securely).

This guide does not cover setting up Postfix Virtual Domains, for information on Virtual Domains and other advanced configurations see Section 1.7.3, “References” [p. 193].

Installation

To install postfix run the following command:

sudo apt-get install postfix

Simply press return when the installation process asks questions, the configuration will be done in greater detail in the next stage.

Basic Configuration

To configure postfix, run the following command:

sudo dpkg-reconfigure postfix

The user interface will be displayed. On each screen, select the following values:

  • Internet Site
  • mail.example.com
  • steve
  • mail.example.com, localhost.localdomain, localhost
  • No
  • 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/24 •0
    •+
    • allReplace mail.example.com with the domain for which you’ll accept email, 192.168.0.0/24 with the actual network and class range of your mail server, and steve with the appropriate username.Now is a good time to decide which mailbox format you want to use. By default Postfix will use mbox for the mailbox format. Rather than editing the configuration file directly, you can use the postconf command to configure all postfix parameters. The configuration parameters will be stored in

/etc/postfix/main.cf file. Later if you wish to re-configure a particular parameter, you can either run the command or change it manually in the file.

To configure the mailbox format for Maildir: sudo postconf -e ‘home_mailbox = Maildir/’

This will place new mail in /home/username/Maildir so you will need to configure your Mail Delivery Agent (MDA) to use the same path.

SMTP Authentication

SMTP-AUTH allows a client to identify itself through an authentication mechanism (SASL). Transport Layer Security (TLS) should be used to encrypt the authentication process. Once authenticated the SMTP server will allow the client to relay mail.

  1. Configure Postfix for SMTP-AUTH using SASL (Dovecot SASL):
        sudo postconf -e 'smtpd_sasl_type = dovecot'
        sudo postconf -e 'smtpd_sasl_path = private/auth-client'
        sudo postconf -e 'smtpd_sasl_local_domain ='
        sudo postconf -e 'smtpd_sasl_security_options = noanonymous'
        sudo postconf -e 'broken_sasl_auth_clients = yes'
        sudo postconf -e 'smtpd_sasl_auth_enable = yes'
        sudo postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,re

    The smtpd_sasl_path configuration is a path relative to the Postfix queue directory.

  2. Next, generate or obtain a digital certificate for TLS. See Section 5, “Certificates” [p. 128] for details. This example also uses a Certificate Authority (CA). For information on generating a CA certificate see Section 5.5, “Certification Authority” [p. 130].MUAs connecting to your mail server via TLS will need to recognize the certificate used for TLS. This can either be done using a certificate from a commercial CA or with a self-signed certificate that users manually install/accept. For MTA to MTA
    TLS certficates are never validated without advance agreement from the affected organizations. For MTA to MTA TLS, unless local policy requires it, there is no reason not to use a self-signed certificate. Refer to Section 5.3, “Creating a Self-Signed Certificate” [p. 130] for more details.
  3. Once you have a certificate, configure Postfix to provide TLS encryption for both incoming and outgoing mail:
        sudo postconf -e 'smtp_tls_security_level = may'
        sudo postconf -e 'smtpd_tls_security_level = may'
        sudo postconf -e 'smtp_tls_note_starttls_offer = yes'
    sudo postconf -e 'smtpd_tls_key_file = /etc/ssl/private/server.key'
    sudo postconf -e 'smtpd_tls_cert_file = /etc/ssl/certs/server.crt'
    sudo postconf -e 'smtpd_tls_loglevel = 1'
    sudo postconf -e 'smtpd_tls_received_header = yes'
    sudo postconf -e 'myhostname = mail.example.com'

4. If you are using your own Certificate Authority to sign the certificate enter: sudo postconf -e ‘smtpd_tls_CAfile = /etc/ssl/certs/cacert.pem’

Again, for more details about certificates see Section 5, “Certificates” [p. 128].
After running all the commands, Postfix is configured for SMTP-AUTH and a self-signed

certificate has been created for TLS encryption. Now, the file /etc/postfix/main.cf should look like this1.

The postfix initial configuration is complete. Run the following command to restart the postfix daemon:

sudo /etc/init.d/postfix restart

Postfix supports SMTP-AUTH as defined in RFC25542. It is based on SASL3. However it is still necessary to set up SASL authentication before you can use SMTP-AUTH.

Configuring SASL

Postfix supports two SASL implementations Cyrus SASL and Dovecot SASL. To enable Dovecot SASL the dovecot-common package will need to be installed. From a terminal prompt enter the following:

sudo apt-get install dovecot-common

Next you will need to edit /etc/dovecot/dovecot.conf. In the auth default section uncomment the socket listen option and change the following:

  socket listen {
    #master {
      # Master socket provides access to userdb information. It's typically
      # used to give Dovecot's local delivery agent access to userdb so it
      # can find mailbox locations.
      #path = /var/run/dovecot/auth-master
      #mode = 0600
      # Default user/group is the one who started dovecot-auth (root)

1 ../sample/postfix_configuration
2 http://www.ietf.org/rfc/rfc2554.txt 3 http://www.ietf.org/rfc/rfc2222.txt

#user =

#group = #}

    client {
      # The client socket is generally safe to export to everyone. Typical use
      # is to export it to your SMTP server so it can do SMTP AUTH lookups
      # using it.
      path = /var/spool/postfix/private/auth-client
      mode = 0660
      user = postfix
      group = postfix

} }

In order to let Outlook clients use SMTP-AUTH, in the auth default section of /etc/dovecot/ dovecot.conf add “login”:

  mechanisms = plain login

Once you have Dovecot configured restart it with:

sudo /etc/init.d/dovecot restart

Mail-Stack Delivery

Another option for configuring Postfix for SMTP-AUTH is using the mail-stack-delivery package (previously packaged as dovecot-postfix). This package will install Dovecot and configure Postfix to use it for both SASL authentication and as a Mail Delivery Agent (MDA). The package also configures Dovecot for IMAP, IMAPS, POP3, and POP3S.

You may or may not want to run IMAP, IMAPS, POP3, or POP3S on your mail server. For example, if you are configuring your server to be a mail gateway, spam/virus filter, etc. If this is the case it may be easier to use the above commands to configure Postfix for SMTP- AUTH.

To install the package, from a terminal prompt enter:

sudo apt-get install mail-stack-delivery

You should now have a working mail server, but there are a few options that you may wish to further customize. For example, the package uses the certificate and key from the ssl-cert package, and in a production environment you should use a certificate and key generated for the host. See Section 5, “Certificates” [p. 128] for more details.

Once you have a customized certificate and key for the host, change the following options in /etc/ postfix/main.cf:

smtpd_tls_cert_file = /etc/ssl/certs/ssl-mail.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-mail.key

Then restart Postfix:

sudo /etc/init.d/postfix restart

Testing

SMTP-AUTH configuration is complete. Now it is time to test the setup.
To see if SMTP-AUTH and TLS work properly, run the following command:

telnet mail.example.com 25

After you have established the connection to the postfix mail server, type:

ehlo mail.example.com

If you see the following lines among others, then everything is working perfectly. Type quit to exit.

250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250 8BITMIME

Troubleshooting

This section introduces some common ways to determine the cause if problems arise. 1.7.1. Escaping chroot

The Ubuntu postfix package will by default install into a chroot environment for security reasons. This can add greater complexity when troubleshooting problems.

To turn off the chroot operation locate for the following line in the /etc/postfix/master.cf configuration file:

smtp inetn – – – – smtpd

and modify it as follows:

smtp inetn – n – – smtpd

You will then need to restart Postfix to use the new configuration. From a terminal prompt enter:

sudo /etc/init.d/postfix restart

Postfix sends all log messages to /var/log/mail.log. However error and warning messages can sometimes get lost in the normal log output so they are also logged to /var/log/mail.err and /var/ log/mail.warn respectively.

To see messages entered into the logs in real time you can use the tail -f command:

tail -f /var/log/mail.err

The amount of detail that is recorded in the logs can be increased. Below are some configuration options for increasing the log level for some of the areas covered above.

  • To increase TLS activity logging set the smtpd_tls_loglevel option to a value from 1 to 4.
      sudo postconf -e 'smtpd_tls_loglevel = 4'
  • If you are having trouble sending or receiving mail from a specific domain you can add the domain to the debug_peer_list parameter.
      sudo postconf -e 'debug_peer_list = problem.domain'
  • You can increase the verbosity of any Postfix daemon process by editing the/etc/postfix/ master.cf and adding a -v after the entry. For example edit the smtp entry:
      smtp      unix  -       -       -       -       -       smtp -v

    It is important to note that after making one of the logging changes above the Postfix process will need to be reloaded in order to recognize the new configuration: sudo /etc/ init.d/postfix reload

  • To increase the amount of information logged when troubleshooting SASL issues you can set the following options in /etc/dovecot/dovecot.conf
      auth_debug=yes
      auth_debug_passwords=yes

    Just like Postfix if you change a Dovecot configuration the process will need to be reloaded: sudo /etc/init.d/dovecot reload.

    Some of the options above can drastically increase the amount of information sent to the log files. Remember to return the log level back to normal after you have corrected the problem. Then reload the appropriate daemon for the new configuration to take affect.

    References

    Administering a Postfix server can be a very complicated task. At some point you may need to turn to the Ubuntu community for more experienced help.

 A great place to ask for Postfix assistance, and get involved with the Ubuntu Server community, is the #ubuntu-server IRC channel on freenode4. You can also post a message to one of the Web Forums5.

For in depth Postfix information Ubuntu developers highly recommend: The Book of Postfix6. Finally, the Postfix7 website also has great documentation on all the different configuration options

available.
Also, the Ubuntu Wiki Postifx8 page has more information.

Samba File Server

One of the most common ways to network Ubuntu and Windows computers is to configure Samba as a File Server. This section covers setting up a Samba server to share files with Windows clients.

The server will be configured to share files with any client on the network without prompting for a password. If your environment requires stricter Access Controls see Section 4, “Securing a Samba File and Print Server” [p. 236]

2.1. Installation

The first step is to install the samba package. From a terminal prompt enter:

sudo apt-get install samba

That’s all there is to it; you are now ready to configure Samba to share files. 2.2. Configuration

The main Samba configuration file is located in /etc/samba/smb.conf. The default configuration file has a significant amount of comments in order to document various configuration directives.

Not all the available options are included in the default configuration file. See the smb.conf man page or the Samba HOWTO Collection2 for more details.

  1. First, edit the following key/value pairs in the [global] section of /etc/samba/smb.conf:
           workgroup = EXAMPLE
           ...
           security = user

    The security parameter is farther down in the [global] section, and is commented by default. Also, change EXAMPLE to better match your environment.

  2. Create a new section at the bottom of the file, or uncomment one of the examples, for the directory to be shared:
        [share]
            comment = Ubuntu File Server Share
            path = /srv/samba/share
            browsable = yes
            guest ok = yes
            read only = no
            create mask = 0755

• comment: a short description of the share. Adjust to fit your needs. 231

Windows Networking

  • path: the path to the directory to share.This example uses /srv/samba/sharename because, according to the Filesystem Hierarchy Standard (FHS), /srv3 is where site-specific data should be served. Technically Samba shares can be placed anywhere on the filesystem as long as the permissions are correct, but adhering to standards is recommended.
  • browsable: enables Windows clients to browse the shared directory using Windows Explorer.
  • guest ok: allows clients to connect to the share without supplying a password.
  • read only: determines if the share is read only or if write privileges are granted. Write privileges are allowed only when the value is no, as is seen in this example. If the value is yes, then access to the share is read only.
  • create mask: determines the permissions new files will have when created.
  1. Now that Samba is configured, the directory needs to be created and the permissions changed.From a terminal enter:
        sudo mkdir -p /srv/samba/share
        sudo chown nobody.nogroup /srv/samba/share/

    The -p switch tells mkdir to create the entire directory tree if it doesn’t exist.

  2. Finally, restart the samba services to enable the new configuration:
        sudo restart smbd
        sudo restart nmbd

    Once again, the above configuration gives all access to any client on the local network. For a more secure configuration see Section 4, “Securing a Samba File and Print Server” [p. 236].

From a Windows client you should now be able to browse to the Ubuntu file server and see the shared directory. If your client doesn’t show your share automatically, try to access your server by its IP address, e.g. \\192.168.1.1, in a Windows Explorer window. To check that everything is working try creating a directory from Windows.

To create additional shares simply create new [dir] sections in /etc/samba/smb.conf, and restart Samba. Just make sure that the directory you want to share actually exists and the permissions are correct.

The file share named “[share]” and the path /srv/samba/share are just examples. Adjust the share and path names to fit your environment. It is a good idea to name a share after a directory on the file system. Another example would be a share name of [qa] with a path of /srv/samba/qa.

232

Windows Networking

2.3. Resources

  • For in depth Samba configurations see the Samba HOWTO Collection4
  • The guide is also available in printed format5.
  • O’Reilly’s Using Samba6 is another good reference.
  • The Ubuntu Wiki Samba 7 page.

 

apt-get command cheat sheet for Debian Linux

apt-get is the command-line tool for handling packages for Debian Linux which is use to:

  • Install/manage individual packages
  • Upgrade packages
  • Apply security patch(s)
  • Keep Debian system up to date
  • Download source .deb files
  • Front-end to many GUI and other utilities

Here is quick cheat sheet you will find handy while using apt-get at shell prompt:

Syntax Description Example(s)
apt-get install {package} Install the new package. If package is installed then try to upgrade to latest version apt-get install zip
apt-get install lsof samba mysql-client
apt-get remove {package} Remove/Delete an installed package except configuration files apt-get remove zip
apt-get –purge remove {package} Remove/Delete everything including configuration files apt-get –purge remove mysql-server
apt-get update
apt-get upgrade
Resynchronize the package index files and Upgrade the Debian Linux system including security update (Internet access required) apt-get update
apt-get upgrade
apt-get update
apt-get dist-upgrade
Usually use to upgrade to Debian distribution. For example Woody to Sarge upgrade. ‘dist-upgrade’ in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a “smart” conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. apt-get update
apt-get dist-upgrade

 

VIRTUALBOX

Using this site as a guide:

http://www.ubuntubuzz.com/2011/10/install-virtualbox-41-on-ubuntu-1110.html

Start out by adding the new oracle Virtualbox repository to /etc/apt/sources.list:

deb http://download.virtualbox.org/virtualbox/debian oneiric contrib

Then execute the following:

apt-get update
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | 
sudo apt-key add -
apt-get install virtualbox-4.1  (was 4.1.4 on Feb 14, 2012, as of Mar 6, 2012 4.1.8)

Install extension pack from here

(http://download.virtualbox.org/virtualbox/4.1.4/Oracle_VM_VirtualBox_Extension_Pack-4.1.4-74291.vbox-extpack)
(http://download.virtualbox.org/virtualbox/4.1.8/Oracle_VM_VirtualBox_Extension_Pack-4.1.8-75467.vbox-extpack)

by using the command line:

VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.1.4-74291.vbox-extpack

To Look and see which extension packs are installed:

VBoxManage list extpacks

Extension Packs: 1
Pack no. 0: Oracle VM VirtualBox Extension Pack
Version: 4.1.8
Revision: 75467
Description: USB 2.0 Host Controller, VirtualBox RDP, PXE ROM with E1000 support.
VRDE Module: VBoxVRDP
Usable: true
Why unusable:

 

Now let’s create the VM and start it up and view it with RDP:

Step by step: creating a virtual machine on a headless server

The following instructions may give you an idea how to create a virtual machine on a headless server over a network connection. We will create a virtual machine, establish an RDP connection and install a guest operating system — all without having to touch the headless server. All you need is the following:

  1. VirtualBox on a server machine with a supported host operating system. The VirtualBox extension pack for the VRDP server must be installed (see the previous section). For the following example, we will assume a Linux server.
  2. An ISO file accessible from the server, containing the installation data for the guest operating system to install (we will assume Windows XP in the following example).
  3. A terminal connection to that host through which you can access a command line (e.g. via ssh).
  4. An RDP viewer on the remote client; see the section called “Common third-party RDP viewers” above for examples.

Note again that on the server machine, since we will only use the headless server, neither Qt nor SDL nor the X Window system will be needed.

  1. On the headless server, create a new virtual machine:
    VBoxManage createvm --name "Windows XP" --ostype WindowsXP --register

    Note that if you do not specify --register, you will have to manually use the registervm command later.

    Note further that you do not need to specify --ostype, but doing so selects some sane default values for certain VM parameters, for example the RAM size and the type of the virtual network device. To get a complete list of supported operating systems you can use

    VBoxManage list ostypes
  2. Make sure the settings for this VM are appropriate for the guest operating system that we will install. For example:
    VBoxManage modifyvm "Windows XP" --memory 256 --acpi on --boot1 dvd --nic1 nat
  3. Create a virtual hard disk for the VM (in this case, 10GB in size):
    VBoxManage createhd --filename "WinXP.vdi" --size 10000
  4. Add an IDE Controller to the new VM:
    VBoxManage storagectl "Windows XP" --name "IDE Controller"
          --add ide --controller PIIX4
  5. Set the VDI file created above as the first virtual hard disk of the new VM:
    VBoxManage storageattach "Windows XP" --storagectl "IDE Controller"
          --port 0 --device 0 --type hdd --medium "WinXP.vdi"
  6. Attach the ISO file that contains the operating system installation that you want to install later to the virtual machine, so the machine can boot from it:
    VBoxManage storageattach "Windows XP" --storagectl "IDE Controller"
          --port 0 --device 1 --type dvddrive --medium /full/path/to/iso.iso
  7. Start the virtual machine using VBoxHeadless:
    VBoxHeadless --startvm "Windows XP"

    If everything worked, you should see a copyright notice. If, instead, you are returned to the command line, then something went wrong.

  8. On the client machine, fire up the RDP viewer and try to connect to the server (see the section called “Common third-party RDP viewers” above for how to use various common RDP viewers).You should now be seeing the installation routine of your guest operating system remotely in the RDP viewer.
Here are my commands:

VBoxManage createvm –name “Win7-2012” –ostype Windows7_64 –register

VBoxManage modifyvm “Win7-2012” –memory 2048 –vram 64 –acpi on –boot1 dvd –nic1 bridged –bridgeadapter1 eth0

VBoxManage storagectl “Win7-2012” –name “IDE Controller” –add ide

 VBoxManage storageattach “Win7-2012” –storagectl “IDE Controller” –port 0 –device 0 –type hdd –medium /root/VirtualBox\ VMs/HardDisks/Win7-003.vdi
VBoxManage storageattach “Win7-2012” –storagectl “IDE Controller” –port 0 –device 1 –type dvddrive –medium /usr/share/virtualbox/VBoxGuestAdditions.iso
VBoxHeadless –startvm “Win7-2012”
Here’s the output from:

showvminfo “Win7-2012”
Name: Win7-2012
Guest OS: Windows 7 (64 bit)
UUID: b072dfe8-e82c-4ad6-828b-96c827e197fe
Config file: /root/VirtualBox VMs/Win7-2012/Win7-2012.vbox
Snapshot folder: /root/VirtualBox VMs/Win7-2012/Snapshots
Log folder: /root/VirtualBox VMs/Win7-2012/Logs
Hardware UUID: b072dfe8-e82c-4ad6-828b-96c827e197fe
Memory size: 2048MB
Page Fusion: off
VRAM size: 8MB
CPU exec cap: 100%
HPET: off
Chipset: piix3
Firmware: BIOS
Number of CPUs: 1
Synthetic Cpu: off
CPUID overrides: None
Boot menu mode: message and menu
Boot Device (1): DVD
Boot Device (2): DVD
Boot Device (3): HardDisk
Boot Device (4): Not Assigned
ACPI: on
IOAPIC: on
PAE: on
Time offset: 0 ms
RTC: local time
Hardw. virt.ext: on
Hardw. virt.ext exclusive: on
Nested Paging: on
Large Pages: off
VT-x VPID: on
State: running (since 2012-02-15T02:34:34.885000000)
Monitor count: 1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Storage Controller Name (0): IDE Controller
Storage Controller Type (0): PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0): 2
Storage Controller Port Count (0): 2
Storage Controller Bootable (0): on
IDE Controller (0, 0): /root/VirtualBox VMs/HardDisks/Win7-003.vdi (UUID: ff1f9604-5104-481d-8608-ceda722933bb)
IDE Controller (0, 1): /usr/share/virtualbox/VBoxGuestAdditions.iso (UUID: 89807b6d-04e5-461b-bd56-97bdb7ec2da2)
NIC 1: MAC: 080027DACA2B, Attachment: Bridged Interface ‘eth0’, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny
NIC 2: disabled
NIC 3: disabled
NIC 4: disabled
NIC 5: disabled
NIC 6: disabled
NIC 7: disabled
NIC 8: disabled
Pointing Device: PS/2 Mouse
Keyboard Device: PS/2 Keyboard
UART 1: disabled
UART 2: disabled
Audio: disabled
Clipboard Mode: Bidirectional
Video mode: 1024x768x24
VRDE: enabled (Address 0.0.0.0, Ports 3389, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
VRDE port: 3389
Video redirection: disabled
VRDE property: TCP/Ports = “3389”
VRDE property: TCP/Address = <not set>
VRDE property: VideoChannel/Enabled = <not set>
VRDE property: VideoChannel/Quality = <not set>
VRDE property: Client/DisableDisplay = <not set>
VRDE property: Client/DisableInput = <not set>
VRDE property: Client/DisableAudio = <not set>
VRDE property: Client/DisableUSB = <not set>
VRDE property: Client/DisableClipboard = <not set>
VRDE property: Client/DisableUpstreamAudio = <not set>
VRDE property: H3DRedirect/Enabled = <not set>
VRDE property: Security/Method = <not set>
VRDE property: Security/ServerCertificate = <not set>
VRDE property: Security/ServerPrivateKey = <not set>
VRDE property: Security/CACertificate = <not set>
USB: disabled

USB Device Filters:

<none>

Available remote USB devices:

<none>

Currently Attached USB Devices:

<none>

Shared folders: <none>

VRDE Connection: not active
Clients so far: 0

Guest:

Configured memory balloon size: 0 MB
OS type: Windows7_64
Additions run level: 0

Guest Facilities:

Facility “Seamless Mode”: not active (last update: 2012/02/15 02:34:59 UTC)
Facility “Graphics Mode”: active/running (last update: 2012/02/15 02:34:59 UTC)

 

Autostart Headless VirtualBox

In /etc/init.d, create startvms with the below code:
#!/bin/bash
### BEGIN INIT INFO
# Provides:          startvms
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start my VMs at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO
case "$1" in
  start)
        echo "Starting"
        nohup VBoxHeadless --startvm "UbuntuServer" &
        ;;
  stop)
        echo "Stopping $DESC"
        VBoxManage controlvm "UbuntuServer" poweroff
        ;;

  restart|force-reload)
        echo "Restarting $DESC"
        VBoxManage controlvm "UbuntuServer" poweroff
        nohup VBoxHeadless --startvm "UbuntuServer" &
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

Then run

sudo update-rc.d startvms defaults 99 10
To update init.d and rc files