Trucs et Astuces sur Ubuntu
Document version 1.0


Retour à la page d'accueil

Table des matières


1 Introduction

Cette rubrique liste quelques trucs et astuces avec ubuntu 8.10 (intrepid ibex.)


2 Trucs et Astuces

2.1 Paquetages que j'ajoute à l'installation de base

vim-gnome Pour avoir gvim
tree Liste les fichiers sous forme d'arborescence
imagemagick Manipulation d'images en ligne de commande, entre autres commandes, display, identify, import, convert, animate, montage, mogrify
ubuntu-restricted-extras Pour installer d'un seul coup Flashplayer, Sun JRE, les polices Microsoft usuelles et quelques codecs
gnome-specimen Pour afficher et comparer les polices de caractères
cairo-dock Lanceur hyperbolique
simdock Lanceur hyperbolique, plus simple que cairo-dock
terminator Terminal graphique que l'on peut diviser en plusieurs fenêtres
vrms "Virtual Richard M. Stallman", liste les paquets non libres sur la distribution et, si possible, donne la raison pour laquelle ils ne sont pas libres.
splitvt Coupe un écran de terminal en deux pour exécuter un programme arbitraire (par défaut, un shell) dans chaque moitié séparément. Produit un résultat qui se rapproche de terminator
file-browser-applet Pour afficher un menu répertoire dans la barre des menus GNOME
alltray Mets n'importe quelle application dans le systray

2.2 OOo 3.0 et module import PDF

- Pour l'installation, ajouter au fichier /etc/apt/sources.list les deux lignes suivantes :

	deb http://ppa.launchpad.net/openoffice-pkgs/ubuntu intrepid main
	deb-src http://ppa.launchpad.net/openoffice-pkgs/ubuntu intrepid main

- Pour installer le module d'importation de PDF (version beta au 12 décembre 2008), l'extension doit être récupérée à cette adresse : http://extensions.services.openoffice.org/project/pdfimport


2.3 Chiffrement

D'après Linux Pratique Essentiel numéro 5, décembre 2008 - janvier 2009.


2.4 Utiliser les polices Microsoft dans OpenOffice

Le paquetage msttcorefonts doit être installé. Exemple sur Ubuntu 8.04 :

sebastien@maison-2:~$ dpkg -l mstt*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Nom                      Version                  Description
+++-========================-========================-================================================================
ii  msttcorefonts            2.4                      Installer for Microsoft TrueType core fonts

sebastien@maison-2:~$ dpkg -l x-tt*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Nom                      Version                  Description
+++-========================-========================-================================================================
ii  x-ttcidfont-conf         27                       TrueType and CID fonts configuration for X

Sur Ubuntu 8.04, x-ttcidfont-conf était déjà installé.

Note du 10/01/2010 : désormais le paquet s'appelle ttf-mscorefonts-installer


2.5 USB dans VirtualBox

* Non testé *

- Ajouter au fichier /etc/fstab la ligne suivante :

	none	/proc/bus/usb	usbfs	devgid=vboxusers_group_id,devmode=644	0	0

- Recharger le fichier /etc/fstab en exécutant sudo mount -a
- Ajouter au fichier /etc/init.d/mountkernfs.sh la ligne

	domount usbfs usbdevfs /proc/bus/usb -onoexec,nosuid,nodev,devgid=vboxusers_group_id,devmode=664

2.6 Restreindre les heures de login

Étape 1

Dans le répertoire etc/pam.d, ajouter la ligne

	account  requisite  pam_time.so

aux fichiers correspondant aux programmes de login utilisés. Dans mon cas il y a deux fichiers à modifier, /etc/pam.d/login et /etc/pam.d/gdm.
A noter que dans le fichier login, cette ligne est déjà présente mais commentée.

Fichier /etc/pam.d/login :

#
# The PAM configuration file for the Shadow `login' service
#

# Outputs an issue file prior to each login prompt (Replaces the
# ISSUE_FILE option from login.defs). Uncomment for use
# auth       required   pam_issue.so issue=/etc/issue

# Disallows root logins except on tty's listed in /etc/securetty
# (Replaces the `CONSOLE' setting from login.defs)
auth       requisite  pam_securetty.so

# Disallows other than root logins when /etc/nologin exists
# (Replaces the `NOLOGINS_FILE' option from login.defs)
auth       requisite  pam_nologin.so

# SELinux needs to be the first session rule. This ensures that any 
# lingering context has been cleared. Without out this it is possible 
# that a module could execute code in the wrong domain.  (When SELinux
# is disabled, this returns success.)
session    required   pam_selinux.so close

# This module parses environment configuration file(s)
# and also allows you to use an extended config
# file /etc/security/pam_env.conf.
# 
# parsing /etc/environment needs "readenv=1"
session       required   pam_env.so readenv=1
# locale variables are also kept into /etc/default/locale in etch
# reading this file *in addition to /etc/environment* does not hurt
session       required   pam_env.so readenv=1 envfile=/etc/default/locale

# Standard Un*x authentication.
@include common-auth

# This allows certain extra groups to be granted to a user
# based on things like time of day, tty, service, and user.
# Please edit /etc/security/group.conf to fit your needs
# (Replaces the `CONSOLE_GROUPS' option in login.defs)
auth       optional   pam_group.so

# Uncomment and edit /etc/security/time.conf if you need to set
# time restrainst on logins.
# (Replaces the `PORTTIME_CHECKS_ENAB' option from login.defs
# as well as /etc/porttime)
account    requisite  pam_time.so

# Uncomment and edit /etc/security/access.conf if you need to
# set access limits.
# (Replaces /etc/login.access file)
# account  required       pam_access.so

# Sets up user limits according to /etc/security/limits.conf
# (Replaces the use of /etc/limits in old login)
session    required   pam_limits.so

# Prints the last login info upon succesful login
# (Replaces the `LASTLOG_ENAB' option from login.defs)
session    optional   pam_lastlog.so

# Prints the motd upon succesful login
# (Replaces the `MOTD_FILE' option in login.defs)
session    optional   pam_motd.so

# Prints the status of the user's mailbox upon succesful login
# (Replaces the `MAIL_CHECK_ENAB' option from login.defs). 
#
# This also defines the MAIL environment variable
# However, userdel also needs MAIL_DIR and MAIL_FILE variables
# in /etc/login.defs to make sure that removing a user 
# also removes the user's mail spool file.
# See comments in /etc/login.defs
session    optional   pam_mail.so standard

# Standard Un*x account and session
@include common-account
@include common-session
@include common-password

# SELinux needs to intervene at login time to ensure that the process
# starts in the proper default security context. Only sessions which are
# intended to run in the user's context should be run after this.  (When
# SELinux is disabled, this returns success.)
session required pam_selinux.so open

Fichier /etc/pam.d/gdm :

#%PAM-1.0
auth    requisite       pam_nologin.so
auth    required        pam_env.so readenv=1
auth    required        pam_env.so readenv=1 envfile=/etc/default/locale
@include common-auth
auth    optional        pam_gnome_keyring.so
@include common-account
account requisite       pam_time.so
session required        pam_limits.so
@include common-session
session optional        pam_gnome_keyring.so auto_start
@include common-password

Étape 2

Définir les restrictions dans le fichier /etc/security/time.conf. À noter que je n'ai pu configurer avec succès de restriction en utilisant le symbole |, d'où, l'utilisation de lignes multiples dans le fichier.

Fichier /etc/security/time.conf :

# this is an example configuration file for the pam_time module. Its syntax 
# was initially based heavily on that of the shadow package (shadow-960129).
#
# the syntax of the lines is as follows:
#
#       services;ttys;users;times
#
# white space is ignored and lines maybe extended with '\\n' (escaped
# newlines). As should be clear from reading these comments,
# text following a '#' is ignored to the end of the line.
#
# the combination of individual users/terminals etc is a logic list
# namely individual tokens that are optionally prefixed with '!' (logical
# not) and separated with '&' (logical and) and '|' (logical or).
#
# services
#	is a logic list of PAM service names that the rule applies to.
#
# ttys
#	is a logic list of terminal names that this rule applies to.
#
# users
#	is a logic list of users or a netgroup of users to whom this
#	rule applies.
#
# NB. For these items the simple wildcard '*' may be used only once.
#
# times
#	the format here is a logic list of day/time-range
#	entries the days are specified by a sequence of two character
#	entries, MoTuSa for example is Monday Tuesday and Saturday. Note
#	that repeated days are unset MoMo = no day, and MoWk = all weekdays
#	bar Monday. The two character combinations accepted are
#
#		Mo Tu We Th Fr Sa Su Wk Wd Al
#
#	the last two being week-end days and all 7 days of the week
#	respectively. As a final example, AlFr means all days except Friday.
#
#	each day/time-range can be prefixed with a '!' to indicate "anything
#	but"
#
#	The time-range part is two 24-hour times HHMM separated by a hyphen
#	indicating the start and finish time (if the finish time is smaller
#	than the start time it is deemed to apply on the following day).
#
# for a rule to be active, ALL of service+ttys+users must be satisfied
# by the applying process.
#

#
# Here is a simple example: running blank on tty* (any ttyXXX device),
# the users 'you' and 'me' are denied service all of the time
#

#blank;tty* & !ttyp*;you|me;!Al0000-2400

# Another silly example, user 'root' is denied xsh access
# from pseudo terminals at the weekend and on mondays.

#xsh;ttyp*;root;!WdMo0000-2400

#
# End of example file.
#

gdm;*;albert;Al0730-2100
login;*;albert;Al0730-2100
gdm;*;bernard;Al0730-2100
login;*;bernard;Al0730-2100

2.7 Contrôle parental

Paquets

Installer les paquets dansguardian et squid. À noter que gadmin-squid n'apporte pas grand chose. Squid est un programme de proxy, dansguardian réalise du filtrage de contenu + anti-virus, avec clamav par défaut.

sebastien@maison-2:~$ dpkg -l dansguardian
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/H=à garder/besoin Réinstallation/X=les deux (État,Err: majuscule=mauvais)
||/ Nom                           Version                       Description
+++-=============================-=============================-==========================================================================
ii  dansguardian                  2.9.9.7-2                     Web content filtering
sebastien@maison-2:~$ dpkg -l squid
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/H=à garder/besoin Réinstallation/X=les deux (État,Err: majuscule=mauvais)
||/ Nom                           Version                       Description
+++-=============================-=============================-==========================================================================
ii  squid                         2.7.STABLE3-1ubuntu2          Internet object cache (WWW proxy cache)

Configuration de squid

Configuration de dansguardian

La configuration est faite dans le fichier /etc/dansguardian/dansguardian.conf

Pour autoriser un site bloqué par dansguardian, l'ajouter au fichier /etc/dansguardian/lists/exceptionsitelist.
Pour autoriser une extension de fichier bloquée, l'enlever du fichier /etc/dansguardian/lists/bannedextensionlist. Par défaut, les types d'archive tels que .zip et .gz sont interdits.

À ce stade dansguardian doit fonctionner en écoute sur le port 8080 et connexion en local sur le port 3128, port par défaut de squid.


2.8 Verrouiller la configuration de Firefox avec proxy

Ajouter au fichier /etc/firefox-3.0/pref/firefox.js des lignes lockPref portant sur la configuration du proxy. Résultat :

// This is the Debian specific preferences file for Mozilla Firefox
// You can make any change in here, it is the purpose of this file.
// You can, with this file and all files present in the
// /etc/firefox/pref directory, override any preference that is
// present in /usr/lib/firefox/defaults/pref directory.
// While your changes will be kept on upgrade if you modify files in
// /etc/firefox/pref, please note that they won't be kept if you
// do them in /usr/lib/firefox/defaults/pref.

pref("extensions.update.enabled", true);

// Use LANG environment variable to choose locale
pref("intl.locale.matchOS", true);

// Disable default browser checking.
pref("browser.shell.checkDefaultBrowser", false);

// Prevent EULA dialog to popup on first run
pref("browser.EULA.override", true);

// identify ubuntu @ yahoo searchplugin
pref("browser.search.param.yahoo-fr", "ubuntu");

lockPref("network.proxy.ftp", "localhost");
lockPref("network.proxy.ftp_port", 8080);
lockPref("network.proxy.gopher", "localhost");
lockPref("network.proxy.gopher_port", 8080);
lockPref("network.proxy.http", "localhost");
lockPref("network.proxy.http_port", 8080);
lockPref("network.proxy.no_proxies_on", "localhost, 127.0.0.1, 192.168.1.0/24");
lockPref("network.proxy.share_proxy_settings", true);
lockPref("network.proxy.socks", "localhost");
lockPref("network.proxy.socks_port", 8080);
lockPref("network.proxy.ssl", "localhost");
lockPref("network.proxy.ssl_port", 8080);
lockPref("network.proxy.type", 1);

2.9 Installer PERL/Tk

  1. Installer la librairie libx11-dev, pour pouvoir compiler ensuite le module Tk
  2. Exécuter perl -MCPAN -e shell puis force install Tk

2.9 Installer l'interface MINT ou MGSE

Pour MINT, exécuter les commandes ci-dessous.

sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable
sudo apt-get update
sudo apt-get install cinnamon muffin

Pour MGSE, exécuter les commandes ci-dessous.

sudo add-apt-repository ppa:webupd8team/gnome3
sudo apt-get update
sudo apt-get install mgse-bottompanel mgse-menu mgse-windowlist

2.98 Quelques trucs


2.99 Quelques URL utiles