Site perso : Emmanuel Branlard
When booting into single user mode you will not be prompted for the root password. This is something every attacker knows and prays on once he has gained physical access to you box. So what do you do? su:S:wait:/sbin/sulogin to /etc/inittab
edit php.ini , search for expose and turn it off sudo vim /etc/php5/apache2/php.ini
installer ntp
aptitude install libpam-passwdqc
http://ubuntuforums.org/showthread.php?t=50054 Edit /lib/lsb/init-functions Find the log_end_msg () function, all the way at the bottom of the file - Add GREEN=`$TPUT setaf 2` below RED=`$TPUT setaf 1` - Instead of echo "." : echo "$UP$END[ ${GREEN}ok${NORMAL} ]" %%% For instance, what I've donee: log_begin_msg () { if [ -z "${1:-}" ]; then return 1 fi if log_use_fancy_output; then GREEN=`$TPUT setaf 2` NORMAL=`$TPUT op` else GREEN='' NORMAL='' fi echo -n " $NORMAL[$GREEN*$NORMAL] $@" #echo -n " $@" } if log_use_fancy_output; then RED=`$TPUT setaf 1` GREEN=`$TPUT setaf 2` YELLOW=`$TPUT setaf 3` NORMAL=`$TPUT setaf 7` # BOLD=`$TPUT bold` # UNBOLD=`$TPUT rmso` COLS=$($TPUT cols) COL=$(($COLS-8)) # UP=$($TPUT cuu1) END=$($TPUT hpa $COL) START=$($TPUT hpa 0) else RED='' GREEN='' YELLOW='' NORMAL='' fi if [ $1 -eq 0 ]; then /bin/echo -e "$START$NORMAL[${GREEN} ok ${NORMAL}]" elif [ $1 -eq 255 ]; then /bin/echo -e "$START$NORMAL[${YELLOW}warn${NORMAL}]" else #/bin/echo -e "$END$NORMAL[${RED}fail${NORMAL}]" /bin/echo -e "$START$NORMAL[${RED}fail${NORMAL}]" fi
logrotate se charge de ca, par default en cron.daily. Perso je le fou en cron.weekly. Modifier le /etc/logrotate.conf
lspci lsusb
sudo ifconfig Regarder apres HWaddress
dmesg /var/log/kren.log messages.log syslog.log utile de les voir avec gnome-system-log Bootlog : aller voir /etc/default/bootlogd =Yes
ADD a NETPATH in the file /etc/updatedb.conf or /etc/cron.daily/locate
ESC est le cactere code ACII 27 soit en octal 033 L'inserer avec vim en mode insertion : Ctrl+V Ctrl+Esc ( affiche ^[ <=> ESC) #Les plus important : Wherever you see '#', that should be replaced by the appropriate number. ESC[2J Clear screen and home cursor ESC[#;#;....;#m Set display attributes where # is 0 : normal display 1 : bold 4 : underline 5 : blink 22:normal 30 black foreground 31 red foreground 32 green foreground 33 yellow foreground 34 blue foreground 35 magenta foreground 36 cyan foreground 37 white foreground 39 default foreground 40 black background 41 red background 42 green background 43 yellow background 44 blue background 45 magenta background 46 cyan background 47 white background 49 default background #Liste complete : http://isthe.com/chongo/tech/comp/ansi_escapes.php
The line before the login is configured in the file /etc/issue
# Less messages : First of all, change VERBOSE=yes to VERBOSE=no in /etc/default/rcS. This get rid of some messages from the boot scripts. Next, add 'quiet' as a kernel option in /boot/grub/menu.cfg. This tell the kernel and initramfs to be more quiet on the console. # Usplash Last, install the usplash package. This enable color coding of the boot messages. You do not have to enable the splash support to get the color coding. If you do want to enable the splash support, I recommend installing some other splash image, for example the one in debian-edu-artwork-usplash. To enable the splash support add 'splash' as a kernel option in /boot/grub/menu.cfg. #also sudo aptitude install startupmanager
#Inverse search to see dependencies aptitude search '~i~Dbash' #purge tous les paquest qui sont dans l'etat "c" (deleted mais configuration) aptitude purge ~c # Install source packages (as user preferably)!!! apt-get source PACKAGE # Install dependencies to build the sources !!! apt-get build-dep PACKAGE %%% DPKG - % package installed dpkg -l % Output all packges installed, and use this list to restore a system install dpkg --get-selections > liste.dpkg dpkg --set-selections < liste.dpkg # package list per repository / liste de paquets par repository, (requires to install apt-show-versions) apt-show-versions | grep unstable apt-show-versions | grep -v squeeze apt-cache policy aptitude search "?installed?origin(Debian)" %%% when a package really is impossible to configure / remove - Try the force option of apt-get - edit /var/lib/status, and remove the entry corresponding at the package. CAREFUL!!!!!!!!!!!!! Do Backups! dpkg -L package : to list the files concerned by this package ##Aptitude 1st caractere : state p : non present sur le systeme i: installe u:paquet virtuel c : supprime mais config sur le system 2 eme: action prevue i:install d: suppr p:purger, supprimer + supprimer config A : installe automatiquement clean : supprime tous les paquets du cache : /var/cache/apt/archives autoclean: supprime sueleument les anciens paquets
# /etc/apt/sources.list #/etc/apt/preferences # que l'on check avec apt-cache policy aptitude dist-upgrade -d apt-cache policy nvidia-glx apt-cache policy nvidia-kernel-source dpkg -l|grep nvidia apt-get update apt-get install nvidia-kernel-source m-a a-i nvidia-kernel-source apt-get install nvidia-glx
#to relaod /etc/mtab and /etc/fstab mount -a
sudo vim /etc/hostname
%%% Simple option Simply use UNetbootin (multiplatform, exists as a linux package) %%% More advance, format partitions, and make it bootable http://www.sysresccd.org/Sysresccd-manual-en_How_to_install_SystemRescueCd_on_an_USB-stick #aptitude install fsarchiver (just to check) #fsarchiver probe # s'il y a une partition mount -t vfat /dev/sdf1 /mnt/usbstick # reinitialization de la table des partitions cfdisk /dev/sdb Select type LBA FAT32 # formatting and labelling the partition mkfs.vfat -F 32 -n PARTITIONNAME /dev/sdb1 % putting syslinux (for boot) aptitude install syslinux % copying the default MBR of syslinux dd if=/usr/share/syslinux/mbr.bin of=/dev/sdb /usr/lib/syslinux/mbr.bin %%% Debian : directly with the file hd-media/boot.img.gz zcat hd-media/boot.img.gz > /dev/sdb1 mount the partition on your USB memory stick (mount /dev/sda1 /mnt) and copy a Debian netinst or businesscard ISO image to it (please note that the file name must end in .ISO). %%%# img file Even though this image is a .img file, it is gzipped, so it needs to be extracted to your target volume: gunzip -c FreeNAS-amd64-embedded-xxx.img | dd of=/dev/sdb
%%%methode 1 cat /proc/cpuinfo model name : AMD Athlon(tm) 64 Processor 3500+ %%%methode 2 (model name : Intel(R) Atom(TM) CPU N270 @ 1.60GHz) perl -e 'print ~123;' 4294967172 #32bits 18446744073709551492 #64 bits %%%methode 3 script C cat test.c #include <stdio.h> #include <unistd.h> int main(void) { printf("%ld CPU (%u bits)\n", sysconf(_SC_NPROCESSORS_ONLN), 8 * sizeof(void*)); return 0; } gcc -W -Wall -O2 test.c a.out 24 CPU (32 bits)
http://www.debian.org/doc/manuals/debian-reference/ch-tips.fr.php Un environnment chroot Debian peut aisément être créé par la commande debootstrap de Woody. Par exemple, pour créer un chroot Sid sur /sid-root avec une connexion Internet rapide : main # cd / ; mkdir /sid-root main # debootstrap sid /sid-root http://ftp.debian.org/debian/ ... regardez le système se télécharger main # echo "proc-sid /sid-root/proc proc none 0 0" >> /etc/fstab main # mount proc-sid /sid-root/proc -t proc main # cp /etc/hosts /sid-root/etc/hosts main # chroot /sid-root /bin/bash chroot # cd /dev; /sbin/MAKEDEV generic ; cd - chroot # apt-setup # set-up /etc/apt/sources.list chroot # vi /etc/apt/sources.list # mettre la source sur unstable chroot # dselect # ou aptitude, installez mc et vim :-) A ce point, vous devriez avoir un système Debian complètement fonctionnel, avec lequel vous pouvez jouer sans avoir peur de toucher votre installation Debian principale.
# hwclock -r #or hwclock --show # hwclock -w #or hwclock --systohc # hwclock -s #or hwclock --hctosys sudo hwclock --hctosys #reset l'heure systeme a partir de l'heure hardware sudo hwclock --systohc #reset l'heure hardware a partir de l'heure systeme sudo date +%H:%M --set="21:42" #set l'heure systeme a celle que l'on veut
Sinon, pour qu'il se lance au démarrage, il faut que tu crées un petit script de rien du tout et que tu le mettes dans ton dossier ou sont les scripts de démarrage... Par exemple, si le script plus haut s'appel automat-ssh.sh, le script de demarrage peut être : ( on l'appelera init-automatssh.sh pour la suite) #!/bin/bash automat-ssh.sh Tu le copies dans /etc/init.d/ Tu lui donnes les bons droits : chmod +x init-automatss.sh Tu repères ton dossier de demarrage. (Si tu ne le connais pas, regarde dans inittab, au niveau du runlevel.) Si c'est 2 (c'est mon cas), alors dans /etc/rc2.d/, tu fais un liens vers ton super script! ln -s /etc/init.d/init-automat.sh /etc/rc2.d/S90automatssh.sh (S90 sera le 90ième service lancé, je mets ça, parce que je pense que ton reseau est deja lancé à ce stade du démarrage...)
%%% Method 1 Fermer le clappet au PC beep avec alsamixer %%% Method 2 X command : to run in a terminal or put in .xinitrc xset b off %%% Method 3 (first check is lsmod returns pcspkr) #You can disable this by editing a file and entering two simple lines. sudo vim /etc/modprobe.d/blacklist #silly speaker beep blacklist pcspkr If you don't want to wait until a reboot, simply type: sudo rmmod pcspkr
#Ajouter l'interface eth0 en dhcp /etc/network/interfaces auto eth0 iface eth0 inet dhcp redemarrer le network : /etc/init.d/networking restart reveiller le reseau avec ifup eth0
http://www.haypocalc.com/wiki/UTF-8_et_Linux #iconv iconv -f iso-8859-1 -t utf-8 <in >out # vers UTF-8 iconv -f utf-8 -t iso-8859-1 <in >out # vers latin-1 iconv -f utf-8 -t iso-8859-1 file1 > file2 #file -i: connaitre l'encodage file -i filename file -i * |grep utf-8 |awk -F: '{print $1;}' |xargs #us-ascii US-ascii ne conteint pas d'accents. La table de caractères us-ascii est strictement inscrite dans utf-8 et tous les caractères de us-ascii ont la même valeur dans us-ascii et dans utf8. Donc vouloir convertir de us-ascii vers utf8 n'a tout simplement pas de sens.
initramfs sudo mkinitramfs -o /boot/initramfs-2.6.26 http://forum.ubuntu-fr.org/viewtopic.php?id=238953
Si tu veux pouvoir reproduire une installation sous Debian, j'ai entendu parler du couple: dpkg --get-selections > liste.dpkg pour lister les paquets installés sur Debian au format pour la commande suivante: dpkg --set-selections < liste.dpkg qui fera le "restaure" des paquets sur une autre machine Debian. si tu veux voir tout tes package installé fait un ls /var/cache/apt/archives Ou encore aptitude search '~i !(~M)'
dpkg-reconfigure locales avoir fr_FR.UTF-8
editer /etc/sudoers pour autoriser sudo avec password ajouter la ligne : %sudo ALL=(ALL) ALL sans password : %sudo ALL=NOPASSWD:ALL
On peut passer par le fichier de sudoers mais le plus simple c'est d'ajouter l'utilisateur au groupe powerdev sudo adduser manu powerdev
Pour l'autologin - Modifier le fichier definissant le terminal principal/les terminaux : ---Sous Debian : Code: gedit /etc/inittab Commenter la ligne :#1:2345:respawn:/sbin/getty tty1 # La remplacer par : 1:2345:respawn:/sbin/mingetty tty1 --autologin MONLOGIN # 1:2345:respawn:/bin/login -f YOUR_USER_NAME tty1 /dev/tty1 2>&1 1:2345:respawn:/bin/login -f manu tty1 /dev/tty1 2>&1 ---Sous Ubuntu : Code: - Installer mingetty : sudo apt-get mingetty gedit /etc/event.d/tty1 Commenter la ligne : #exec /sbin/getty -n 38400 tty1 La remplacer par : exec /sbin/mingetty tty1 --autologin MONLOGIN #exec /sbin/getty -l /usr/sbin/autologin -n 38400 tty1 Mise en garde : Si on a un gestionaire de connexion, il est necessaire de le desactiver! Pour cela j'ai utilise sysv-rc-conf, programe qui permet de gerer les services charges au demarrage. On desactive tous les runlevel de slim ou gdm ou kdm. Quelques remarques : Rq1 : A mon avis l'option autologin ne marche pas avec getty, d'ou le besoin d'utiliser mingetty -> Utiliser login sous Debian Rq2 : Mingetty est equivalent a rungetty, mais soit disant plus light! Rq3 : Sur internet on trouve : utiliser getty en faisant un script shell perso, ou en compilant son propre petit fichier c
- Creer/editer le fichier ~/.bash_profile (en utilisateur, pas en root) Y inserer : Code: # Load X11 #if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then if [ `ps -le |grep startx|wc -l` == 0 ]; then startx fi Permettant ainsi de lancer X a chaque ouverture de session sur le terminal 1. Maintenant si vous avez plusieurs gestionnaire de fenetre (fluxbox/gnome/xfce..), je pense que le choix de celui-ci se fait via le fichier .xinitrc. A confirmer. Rq: j'ai eu un probleme, mes utilisateurs n'avaient pas la permission de lancer startx (erreur : unable to open Xwrapper.config ...). J'ai reinstaller ou reconfigurer, je sais plus, mon serveur x.
You can also use getty to autologin: 1) Create a file /usr/sbin/autologin which is as follows: #! /bin/bash exec login <your_username> Replace <your_username> with the name of the user you want to login automatically. Then make that file executable via sudo chmod a+x /usr/sbin/autologin 2) Edit the file /etc/event.d/tty1 and change the line exec /sbin/getty 38400 tty1 to exec /sbin/getty -l /usr/sbin/autologin -n 38400 tty1