<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Scripting - Gagzen</title>
	<atom:link href="https://gagzen.net/category/scripting/feed/" rel="self" type="application/rss+xml" />
	<link>https://gagzen.net</link>
	<description></description>
	<lastBuildDate>Wed, 25 May 2016 20:42:51 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.1</generator>

<image>
	<url>https://gagzen.net/wp-content/uploads/2026/06/android-chrome-512x512-1-150x150.png</url>
	<title>Scripting - Gagzen</title>
	<link>https://gagzen.net</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Sauvegarde avec rdiff_backup over ssh</title>
		<link>https://gagzen.net/2016/05/25/sauvegarde-avec-rdiff_backup-over-ssh/</link>
		
		<dc:creator><![CDATA[Baptiste]]></dc:creator>
		<pubDate>Wed, 25 May 2016 20:42:51 +0000</pubDate>
				<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Scripting]]></category>
		<guid isPermaLink="false">http://www.gagneux.info/index.php/?p=607</guid>

					<description><![CDATA[<p>Il s&#8217;agit plus ici d&#8217;un billet note, histoire de conserver les commandes. En prérequis il faut sshfs et rdiff-backup d&#8217;installés sur la machine cliente. Une connexion ssh sans mot de passe avec clef est nécessaire. &#160; &#160; &#160; Les commandes : # Sur machine de sauvegarde # Creation d'un container de 50Go dd if=/dev/zero bs=1M [&#8230;]</p>
<p>The post <a href="https://gagzen.net/2016/05/25/sauvegarde-avec-rdiff_backup-over-ssh/">Sauvegarde avec rdiff_backup over ssh</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><a href="https://gagzen.net/wp-content/uploads/2016/05/Backup_center_icon-1.png"><img decoding="async" class="alignleft wp-image-610 size-thumbnail" src="https://gagzen.net/wp-content/uploads/2016/05/Backup_center_icon-150x150.png" alt="Backup_center_icon" width="150" height="150" /></a>Il s&rsquo;agit plus ici d&rsquo;un billet note, histoire de conserver les commandes.</p>
<p>En prérequis il faut sshfs et rdiff-backup d&rsquo;installés sur la machine cliente. Une <a href="http://www.gagneux.info/connexion-ssh-sans-mot-de-passe">connexion ssh sans mot de passe</a> avec clef est nécessaire.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span id="more-607"></span></p>
<p>&nbsp;</p>
<p>Les commandes :<br />
<code><br />
# Sur machine de sauvegarde<br />
# Creation d'un container de 50Go<br />
dd if=/dev/zero bs=1M count=50000 of=/mnt/data/dossierSurGrossePartition/backup_test.luks</p>
<p># Sur machine a sauvegarder<br />
# Preparation du conteneur chiffré<br />
mkdir /mnt/remote_fs /mnt/backup_test<br />
sshfs -o workaround=rename Utilisateur@MachineDestination:/mnt/data/dossierSurGrossePartition/ /mnt/remote_fs<br />
cryptsetup luksFormat -c aes -h sha256 --key-file /cheminVers_la_clef/backup_key-file /mnt/remote_fs/backup_test.luks</p>
<p># Montage du contenur chiffré<br />
cryptsetup luksOpen --key-file /cheminVers_la_clef/backup_key-file /mnt/remote_fs/backup_test.luks test<br />
mkfs.ext4 /dev/mapper/test<br />
mount /dev/mapper/test /mnt/backup_test/</p>
<p># Sauvegarde<br />
mkdir /mnt/backup_test/fichiers /mnt/backup_test/sql<br />
/usr/bin/rdiff-backup --print-statistics --force -v 9 /mnt/data /mnt/backup_test/fichiers/<br />
/usr/bin/mysqldump -u root -pMotDePasse --all-databases --single-transaction &gt; /mnt/backup_test/sql/dump_$(date "+%s").sql</p>
<p># Demontage du contenur chiffré<br />
/sbin/cryptsetup luksClose test<br />
umount /mnt/remote_fs<br />
</code><br />
&nbsp;</p><p>The post <a href="https://gagzen.net/2016/05/25/sauvegarde-avec-rdiff_backup-over-ssh/">Sauvegarde avec rdiff_backup over ssh</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Installation d&#8217;un serveur NIS + Client sur RHEL5.5</title>
		<link>https://gagzen.net/2011/04/01/installation-dun-serveur-nis-client-sur-rhel5-5/</link>
		
		<dc:creator><![CDATA[Baptiste]]></dc:creator>
		<pubDate>Fri, 01 Apr 2011 16:00:53 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[commandes]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nis]]></category>
		<guid isPermaLink="false">http://www.gagneux.info/index.php/?p=411</guid>

					<description><![CDATA[<p>Présentation : Network Information Service (NIS) nommé aussi Yellow Pages est un protocole client serveur développé par Sun permettant la centralisation d&#8217;informations sur un réseau UNIX. Son but est de distribuer les informations contenues dans des fichiers de configuration contenant par exemple les noms d&#8217;hôte (/etc/hosts), les comptes utilisateurs (/etc/passwd), etc. sur un réseau. Un [&#8230;]</p>
<p>The post <a href="https://gagzen.net/2011/04/01/installation-dun-serveur-nis-client-sur-rhel5-5/">Installation d’un serveur NIS + Client sur RHEL5.5</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></description>
										<content:encoded><![CDATA[<p style="text-align: left;"><strong><a href="https://gagzen.net/wp-content/uploads/2011/04/Nuvola_apps_kgpg-1.png"><img decoding="async" class="alignleft size-full wp-image-412" style="margin: 10px;" title="Nuvola_apps_kgpg" src="https://gagzen.net/wp-content/uploads/2011/04/Nuvola_apps_kgpg-1.png" alt="" width="128" height="128" /></a>Présentation : </strong><br />
Network Information Service (NIS) nommé aussi Yellow Pages est un protocole client serveur développé par Sun permettant la centralisation d&rsquo;informations sur un réseau UNIX.<br />
Son but est de distribuer les informations contenues dans des fichiers de configuration contenant par exemple les noms d&rsquo;hôte (/etc/hosts), les comptes utilisateurs (/etc/passwd), etc. sur un réseau.</p>
<p>Un serveur NIS stocke et distribue donc les informations administratives du réseau, qui se comporte ainsi comme un ensemble cohérent de comptes utilisateurs, groupes, machines, etc.</p>
<p>À l&rsquo;origine, NIS est sorti sous le nom de « Yellow Pages » (YP) ou Pages jaunes mais le nom étant déposé par la compagnie britannique British Telecom, Sun a renommé son protocole NIS. Cependant, les commandes NIS commencent toutes par yp.</p>
<p style="text-align: right;">
<em>http://fr.wikipedia.org/wiki/Network_Information_Service</em></p>
<p><strong><span id="more-411"></span>Définitions :</strong><br />
Master NIS : masternis masternis.testnis 192.168.0.1<br />
Client NIS : clientnis clientnis.testnis 192.168.0.2<br />
Domaine NIS : testnis</p>
<p><span style="text-decoration: underline;"><span style="color: #ff0000;"><strong>Partie Serveur : </strong></span></span><br />
Installation des packages yp-tools ypbind ypserv portmap nfsd<br />
# yum install yp-tools ypbind ypserv portmap nfs-utils nfs-utils-lib</p>
<p><span style="text-decoration: underline;">Définition du domaine NIS : </span><br />
# vi /etc/sysconfig/network<br />
Ajout de la ligne<br />
NISDOMAIN=testnis</p>
<p><span style="text-decoration: underline;">Définition du serveur :</span><br />
# vi /etc/yp.conf<br />
Ajout de la ligne<br />
ypserver 127.0.0.1</p>
<p><span style="text-decoration: underline;">Démarrage des services :</span><br />
# service portmap start # Gestion des ports<br />
# service yppasswdd start # gestion de la modification des mots de passe à distance<br />
# service ypserv start # Daemon principal NIS<br />
# service nfs start # Daemon nfs</p>
<p><span style="text-decoration: underline;">Démarrage forcé de ces daemons au lancement du serveur :</span><br />
# chkconfig portmap on<br />
# chkconfig yppasswdd on<br />
# chkconfig ypserv on<br />
# chkconfig nfs on</p>
<p><span style="text-decoration: underline;">Arrêt de autofs et forcage d&rsquo;arrêt au boot </span><br />
# service autofs start # Daemon automount<br />
# chkconfig autofs off</p>
<p><span style="text-decoration: underline;">Modification des fichiers liés à automount : </span><br />
# cat /etc/auto.master<br />
[&#8230;]<br />
/users  yp:auto.home  -timeout=30<br />
+auto.master<br />
# cat /etc/auto.home<br />
* master.testnisbg:/users/&amp;</p>
<p><span style="text-decoration: underline;">Vérification que tout est bien démarré :</span><br />
#  rpcinfo -p 127.0.0.1<br />
program vers proto   port<br />
100000    2   tcp    111  portmapper<br />
100000    2   udp    111  portmapper<br />
100004    2   udp    634  ypserv<br />
100004    1   udp    634  ypserv<br />
100004    2   tcp    637  ypserv<br />
100004    1   tcp    637  ypserv<br />
100009    1   udp    721  yppasswdd</p>
<p><span style="text-decoration: underline;">Configuration du nfs :</span><br />
Modifier le fichier /etc/exports<br />
# cat /etc/exports<br />
/users 192.168.0.0/24(sync)</p>
<p><span style="text-decoration: underline;">Configuration du NIS : </span><br />
# /usr/lib64/yp/ypinit -m # ou /usr/lib/yp/ypinit -m sur un linux 32bits<br />
At this point, we have to construct a list of the hosts which will run NIS<br />
servers.  masternis is in the list of NIS server hosts.  Please continue to add<br />
the names for the other hosts, one per line.  When you are done with the<br />
list, type a &lt;control D&gt;.<br />
next host to add:  masternis<br />
next host to add:<br />
next host to add:<br />
The current list of NIS servers looks like this:</p>
<p>masternis</p>
<p>Is this correct?  [y/n: y]  y<br />
We need a few minutes to build the databases&#8230;<br />
Building /var/yp/testnis/ypservers&#8230;<br />
Running /var/yp/Makefile&#8230;<br />
gmake[1]: Entering directory `/var/yp/testnis&rsquo;<br />
Updating passwd.byname&#8230;<br />
Updating passwd.byuid&#8230;<br />
Updating group.byname&#8230;<br />
Updating group.bygid&#8230;<br />
Updating hosts.byname&#8230;<br />
Updating hosts.byaddr&#8230;<br />
Updating rpc.byname&#8230;<br />
Updating rpc.bynumber&#8230;<br />
Updating services.byname&#8230;<br />
Updating services.byservicename&#8230;<br />
Updating netid.byname&#8230;<br />
Updating protocols.bynumber&#8230;<br />
Updating protocols.byname&#8230;<br />
Updating mail.aliases&#8230;<br />
gmake[1]: Leaving directory `/var/yp/testnis&rsquo;</p>
<p>masternis has been set up as a NIS master server.</p>
<p>Now you can run ypinit -s masternis on all slave server.</p>
<p><span style="text-decoration: underline;">Démarrage des derniers Daemons : </span><br />
# service ypbind start<br />
# service ypxfrd start<br />
# chkconfig ypbind on<br />
# chkconfig ypxfrd on<br />
# rpcinfo -p 127.0.0.1<br />
program vers proto   port<br />
100000    2   tcp    111  portmapper<br />
100000    2   udp    111  portmapper<br />
100004    2   udp    634  ypserv<br />
100004    1   udp    634  ypserv<br />
100004    2   tcp    637  ypserv<br />
100004    1   tcp    637  ypserv<br />
100009    1   udp    721  yppasswdd<br />
100007    2   udp    738  ypbind<br />
100007    1   udp    738  ypbind<br />
100007    2   tcp    741  ypbind<br />
100007    1   tcp    741  ypbind</p>
<p><span style="text-decoration: underline;">Paramétrage du fichier hosts :</span><br />
# vi /etc/hosts<br />
Ajout des lignes :<br />
192.168.0.1    masternis.testnis<br />
192.168.0.2    clientnis.testnis</p>
<p><span style="text-decoration: underline;">Modification du hosts.allow/deny : (à tuner pour une meilleure sécurité !!)</span><br />
# vi /etc/hosts.allow<br />
Ajout de la ligne<br />
ALL: 192.168.0<br />
# vi /etc/hosts.deny<br />
Ajout de la ligne<br />
ALL: ALL</p>
<p><strong><span style="text-decoration: underline;"><span style="color: #ff0000;">Partie Cliente :</span></span></strong><br />
Installation les packages yp-tools ypbind portmap autofs<br />
# yum install yp-tools ypbind portmap autofs</p>
<p><span style="text-decoration: underline;">Paramétrage du fichier hosts :</span><br />
# vi /etc/hosts<br />
ajout des lignes :<br />
192.168.0.1    masternis.testnis<br />
192.168.0.2    clientnis.testnis</p>
<p><span style="text-decoration: underline;">Renommage des fichiers locaux liés à automount pour éviter la confusion avec les fichiers liés à NIS</span><br />
# mv /etc/auto.master /etc/auto.master_OLD<br />
# mv /etc/auto.home /etc/auto.home_OLD</p>
<p><span style="text-decoration: underline;">Modification du nsswitch.conf :</span><br />
# cat /etc/nsswitch.conf<br />
[&#8230;]<br />
#automount:  files nis<br />
automount: nis files</p>
<p><span style="text-decoration: underline;">Création du point de montage des homes users</span><br />
# mkdir /users</p>
<p><span style="text-decoration: underline;">Configuration du NIS :</span><br />
# authconfig &#8211;enableshadow &#8211;enablenis &#8211;nisdomain=testnis &#8211;nisserver=masternis.testnis –update</p>
<p><span style="text-decoration: underline;">Démarrage des daemons :</span><br />
# service portmap start<br />
Starting portmapper: [  OK  ]<br />
# service ypbind restart<br />
Shutting down NIS services:                                [  OK  ]<br />
Binding to the NIS domain:                                 [  OK  ]<br />
Listening for an NIS domain server.<br />
# service autofs restart<br />
Stopping automount:                                        [  OK  ]<br />
ypcatStarting automount:                                   [  OK  ]</p>
<p># chkconfig ypbind on<br />
# chkconfig portmap on<br />
# chkconfig autofs on</p>
<p><span style="text-decoration: underline;">Contrôle que la connexion NIS fonctionne : </span><br />
# ypcat passwd<br />
user02:$1$V1xB1m0G$qT8BnJwY.g0aBIO.BNo4q/:59137:59137::/users/user02:/bin/bash<br />
user01:$1$z91qyCHc$gCRG2kcvaKw6a5U9vA1cx.:59136:59136::/users/user01:/bin/bash</p>
<p><span style="text-decoration: underline;">Test de la connexion avec un user non local : </span><br />
# su &#8211; user01<br />
Si cela fonctionne, vous pourrez vous authentifier, et le path sera /users/user01<br />
# pwd<br />
/users/user01</p>
<p>&nbsp;</p>
<p><em>Sources : </em><br />
<em>http://www.labo-linux.com/articles/software/3049-installation-et-configuration-de-nis-network-information-service?page=1</em><br />
<em>http://www.linuxcream.com/blog/linux-system/linux_redhat/step-by-step-to-configure-nis-in-rhel5-1/</em><br />
<em>http://dawidlinux.pagesperso-orange.fr/libres_fichiers/tuto-nis.html</em><br />
<em>http://iptables.gen.tr/2010/01/nis-server-and-client-configuration/</em></p>
<p><em>image : http://fr.wikipedia.org/wiki/Fichier:Nuvola_apps_kgpg.png</em></p><p>The post <a href="https://gagzen.net/2011/04/01/installation-dun-serveur-nis-client-sur-rhel5-5/">Installation d’un serveur NIS + Client sur RHEL5.5</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Linux &#8211; Ajouter un LV et le monter</title>
		<link>https://gagzen.net/2011/04/01/linux-ajouter-un-lv-et-le-monter/</link>
		
		<dc:creator><![CDATA[Baptiste]]></dc:creator>
		<pubDate>Fri, 01 Apr 2011 16:00:02 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[commandes]]></category>
		<category><![CDATA[linux]]></category>
		<guid isPermaLink="false">http://www.gagneux.info/index.php/?p=418</guid>

					<description><![CDATA[<p>Une note en forme d&#8217;article afin de conserver les commandes de base concernant l&#8217;ajout etle montage d&#8217;un Logical Volume sur un système Linux. &#160; &#160; &#160; &#160; Vérifier la taille disque disponible : # lvm lvm&#62; vgs VG     #PV #LV #SN Attr   VSize  VFree rootvg   1   7   0 wz&#8211;n- 33.72G 11.75G Créer un LV nommé [&#8230;]</p>
<p>The post <a href="https://gagzen.net/2011/04/01/linux-ajouter-un-lv-et-le-monter/">Linux – Ajouter un LV et le monter</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><a href="https://gagzen.net/wp-content/uploads/2011/04/150px-Hard_disk_platters_and_head-1.jpg"><img decoding="async" class="alignleft size-full wp-image-419" style="margin: 10px;" title="150px-Hard_disk_platters_and_head" src="https://gagzen.net/wp-content/uploads/2011/04/150px-Hard_disk_platters_and_head-1.jpg" alt="" width="150" height="150" /></a>Une note en forme d&rsquo;article afin de conserver les commandes de base concernant l&rsquo;ajout etle montage d&rsquo;un Logical Volume sur un système Linux.</p>
<p>&nbsp;</p>
<p><span id="more-418"></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;">Vérifier la taille disque disponible :</span><br />
# lvm<br />
lvm&gt; vgs<br />
VG     #PV #LV #SN Attr   VSize  VFree<br />
rootvg   1   7   0 wz&#8211;n- 33.72G 11.75G</p>
<p><span style="text-decoration: underline;">Créer un LV nommé optvol de 10 Go :</span><br />
# lvcreate &#8211;name optvol &#8211;size= 10G  rootvg</p>
<p><span style="text-decoration: underline;">Formater le nouveau LV en ext3:</span><br />
# mkfs.ext3 /dev/rootvg/optvol</p>
<p><span style="text-decoration: underline;">Monter le nouveau LV sur /opt2</span><br />
# mkdir /opt2<br />
# mount /dev/rootvg/optvol /opt2</p>
<p><span style="text-decoration: underline;">Vérifier : </span><br />
# df -h<br />
Filesystem            Size  Used Avail Use% Mounted on<br />
[&#8230;]<br />
/dev/mapper/rootvg-optvol<br />
10G  4.6M   10G   1% /opt2</p>
<p><span style="text-decoration: underline;">augmentation d&rsquo;un LV : </span><br />
# umount /dev/volgroup/logicalvol<br />
# lvextend -L+6G /dev/volgroup/logicalvol<br />
# e2fsck -f /dev/volgroup/logicalvol<br />
# resize2fs /dev/volgroup/logicalvol<br />
# mount /dev/volgroup/logicalvol</p>
<p><span style="text-decoration: underline;">Diminution d&rsquo;un LV :</span><br />
# umount /dev/volgroup/logicalvol<br />
# lvreduce -L+6G /dev/volgroup/logicalvol<br />
# resize2fs /dev/volgroup/logicalvol 10G<br />
# e2fsck -f /dev/volgroup/logicalvol<br />
# mount /dev/volgroup/logicalvol</p>
<p><em>Source image : http://en.wikipedia.org/wiki/Hard_disk_drive</em></p><p>The post <a href="https://gagzen.net/2011/04/01/linux-ajouter-un-lv-et-le-monter/">Linux – Ajouter un LV et le monter</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Linux &#8211; Ajout de la date dans l&#8217;historique des commandes</title>
		<link>https://gagzen.net/2011/03/30/linux-ajout-de-la-date-dans-lhistorique-des-commandes/</link>
		
		<dc:creator><![CDATA[Baptiste]]></dc:creator>
		<pubDate>Wed, 30 Mar 2011 16:30:57 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[WorkStation]]></category>
		<category><![CDATA[commandes]]></category>
		<category><![CDATA[linux]]></category>
		<guid isPermaLink="false">http://www.gagneux.info/index.php/?p=394</guid>

					<description><![CDATA[<p>La commande history sous Linux est très pratique pour retrouver une commande passée (plus ou moins) récemment. &#160; &#160; &#160; Le défaut que l&#8217;on peut reprocher au résultat de cette commande serait par contre de ne pas indiquer quand la commande a été exécutée. Ainsi, le résultat est de type : En définissant la variable [&#8230;]</p>
<p>The post <a href="https://gagzen.net/2011/03/30/linux-ajout-de-la-date-dans-lhistorique-des-commandes/">Linux – Ajout de la date dans l’historique des commandes</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><a href="https://gagzen.net/wp-content/uploads/2011/03/opensource-1.png"><img decoding="async" class="alignleft size-thumbnail wp-image-163" title="opensource" src="https://gagzen.net/wp-content/uploads/2011/03/opensource-150x150.png" alt="" width="150" height="150" /></a>La commande <span style="color: #0000ff;"><strong>history </strong></span>sous Linux est très pratique pour retrouver une commande passée (plus ou moins) récemment.</p>
<p><span id="more-394"></span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Le défaut que l&rsquo;on peut reprocher au résultat de cette commande serait par contre de ne pas indiquer quand la commande a été exécutée.<br />
Ainsi, le résultat est de type :</p>
<p><a href="https://gagzen.net/wp-content/uploads/2011/03/history_apres-1.jpg"></a><a href="https://gagzen.net/wp-content/uploads/2011/03/history_avant-1.jpg"><img decoding="async" class="aligncenter size-full wp-image-397" title="history_avant" src="https://gagzen.net/wp-content/uploads/2011/03/history_avant-1.jpg" alt="" width="301" height="385" srcset="https://gagzen.net/wp-content/uploads/2011/03/history_avant-1.jpg 301w, https://gagzen.net/wp-content/uploads/2011/03/history_avant-1-235x300.jpg 235w" sizes="(max-width: 301px) 100vw, 301px" /></a></p>
<p>En définissant la variable HISTTIMEFORMAT, on peut formater la sortie :</p>
<p><strong><span style="color: #0000ff;"># HISTTIMEFORMAT=&rsquo;%Y/%m/%d-%Hh%M : &lsquo;</span></strong></p>
<p><a href="https://gagzen.net/wp-content/uploads/2011/03/history_apres1-1.jpg"><img decoding="async" class="aligncenter size-full wp-image-396" title="history_apres" src="https://gagzen.net/wp-content/uploads/2011/03/history_apres1-1.jpg" alt="" width="457" height="384" /></a></p>
<p>Un poil plus exploitable <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Pour bien faire, on peut envisager de définir <strong><span style="color: #0000ff;">HISTTIMEFORMAT </span></strong>dans le .profile de l&rsquo;utilisateur :</p>
<p><strong><span style="color: #0000ff;"># </span><span style="color: #0000ff;">echo « HISTTIMEFORMAT=&rsquo;%Y/%m/%d-%Hh%M : &lsquo; » &gt;&gt; ~/.bash_profile</span></strong></p>
<p><span style="color: #000000;">Ceci fonctionne sous Linux, mais aussi sur différents UNIX </span><strong><span style="color: #0000ff;"><br />
</span></strong></p>
<p>&nbsp;</p>
<p><em>Source : source : http://unix.ittoolbox.com/groups/technical-functional/solaris-l/to-set-date-and-timestamp-on-bash_history-2893951</em></p><p>The post <a href="https://gagzen.net/2011/03/30/linux-ajout-de-la-date-dans-lhistorique-des-commandes/">Linux – Ajout de la date dans l’historique des commandes</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Passer outre la limitation su en interactif</title>
		<link>https://gagzen.net/2010/03/23/passer-outre-la-limitation-su-en-interactif/</link>
		
		<dc:creator><![CDATA[Baptiste]]></dc:creator>
		<pubDate>Tue, 23 Mar 2010 15:01:07 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[interactif]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">http://www.gagneux.info/index.php/?p=154</guid>

					<description><![CDATA[<p>Pré-requis : utiliser windows Ici, on utilise Kitty (fork de Putty) pour se connecter au serveur 10.xx.xx.xx en user, puis on passe root (su -) pour finalement faire un ifconfig et rendre la main. Voici le script en vbs : set prog=wscript.createobject(« WScript.Shell ») prog.Run « kitty.exe -l user -pw password -log fichier_log.txt 10.xx.xx.xx » wscript.sleep 5000 prog.sendkeys « su [&#8230;]</p>
<p>The post <a href="https://gagzen.net/2010/03/23/passer-outre-la-limitation-su-en-interactif/">Passer outre la limitation su en interactif</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></description>
										<content:encoded><![CDATA[<div>
<p>Pré-requis :</p>
<ul>
<li>utiliser windows</li>
</ul>
<p><span id="more-270"></span></p>
</div>
<div>
<p>Ici, on utilise Kitty (fork de Putty)  pour se connecter au serveur 10.xx.xx.xx en user, puis on passe root (su  -) pour finalement faire un ifconfig et rendre la main.</p>
<p>Voici le script en vbs :</p>
<p>set prog=wscript.createobject(« WScript.Shell »)</p>
<p>prog.Run « kitty.exe -l user -pw password -log fichier_log.txt 10.xx.xx.xx »</p>
<p>wscript.sleep 5000</p>
<p>prog.sendkeys « su -~ »</p>
<p>wscript.sleep 2000</p>
<p>prog.sendkeys « password~ »</p>
<p>wscript.sleep 2000</p>
<p>prog.sendkeys « ifconfig »</p>
<p>wscript.sleep 5000</p>
<p>prog.sendkeys « exit~ »</p>
<p>wscript.sleep 2000</p>
<p>prog.sendkeys « exit~ »</p>
<p>&nbsp;</p>
<p>Merci à Jimmy <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
</div><p>The post <a href="https://gagzen.net/2010/03/23/passer-outre-la-limitation-su-en-interactif/">Passer outre la limitation su en interactif</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>winexe : ps exec sous Linux</title>
		<link>https://gagzen.net/2010/03/23/winexe-ps-exec-sous-linux/</link>
					<comments>https://gagzen.net/2010/03/23/winexe-ps-exec-sous-linux/#comments</comments>
		
		<dc:creator><![CDATA[Baptiste]]></dc:creator>
		<pubDate>Tue, 23 Mar 2010 14:58:19 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[commandes]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[windows]]></category>
		<guid isPermaLink="false">http://www.gagneux.info/index.php/?p=152</guid>

					<description><![CDATA[<p>Pré-requis : autoconf Recupérer les sources sur http://eol.ovh.org/winexe/#how_to_get_it Décompresser : tar -jxvf ./winexe-package-sources.tar.bz2 cd ./winexe-directorie ./autogen.sh ./configure make proto bin/winexe Pour finir, déplacer le binaire dans un répertoire du PATH cp bin/winexe /usr/local/sbin/ Utilisation : winexe -U Domaine/Utilisateur%Password //IP « Commande distante » Pour la récupération de l&#8217;heure, la commande distante est : « cmd /c echo %date% [&#8230;]</p>
<p>The post <a href="https://gagzen.net/2010/03/23/winexe-ps-exec-sous-linux/">winexe : ps exec sous Linux</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></description>
										<content:encoded><![CDATA[<div>Pré-requis :</div>
<div>
<ul>
<li> autoconf</li>
</ul>
</div>
<div><span id="more-269"></span></div>
<div>Recupérer les sources sur</div>
<div style="padding-left: 30px;">http://eol.ovh.org/winexe/#how_to_get_it</div>
<div>Décompresser :</div>
<div style="padding-left: 30px;">tar -jxvf ./winexe-package-sources.tar.bz2 cd ./winexe-directorie ./autogen.sh  ./configure  make proto bin/winexe</div>
<div>Pour finir, déplacer le binaire dans un répertoire du PATH</div>
<div style="padding-left: 30px;">cp bin/winexe /usr/local/sbin/</div>
<div>Utilisation :</div>
<div style="padding-left: 30px;">winexe -U Domaine/Utilisateur%Password //IP « Commande distante »</div>
<div>Pour la récupération de l&rsquo;heure, la commande distante est :</div>
<div style="padding-left: 30px;">« cmd /c echo %date% %time% »</div><p>The post <a href="https://gagzen.net/2010/03/23/winexe-ps-exec-sous-linux/">winexe : ps exec sous Linux</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://gagzen.net/2010/03/23/winexe-ps-exec-sous-linux/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Linux GUI : Boîtes de dialogue</title>
		<link>https://gagzen.net/2009/09/04/linux-gui-boites-de-dialogue/</link>
		
		<dc:creator><![CDATA[Baptiste]]></dc:creator>
		<pubDate>Fri, 04 Sep 2009 14:48:26 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[WorkStation]]></category>
		<category><![CDATA[commandes]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[script]]></category>
		<guid isPermaLink="false">http://www.gagneux.info/index.php/?p=139</guid>

					<description><![CDATA[<p>Pré-requis : zenity libnotify Tout simplement excellent : pas encore testé, mais je compte bien faire qqls scripts avec : http://linux.byexamples.com/archives/259/a-complete-zenity-dialog-examples-1/ http://linux.byexamples.com/archives/265/a-complete-zenity-dialog-examples-2/ http://www.korben.info/integrer-une-popup-de-notification-dans-vos-scripts-sous-ubuntu.html</p>
<p>The post <a href="https://gagzen.net/2009/09/04/linux-gui-boites-de-dialogue/">Linux GUI : Boîtes de dialogue</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></description>
										<content:encoded><![CDATA[<div>
<p>Pré-requis :</p>
<ul>
<li>zenity</li>
<li>libnotify</li>
</ul>
</div>
<div>
<p>Tout simplement excellent : pas encore testé, mais je compte bien faire qqls scripts avec :</p>
<p>http://linux.byexamples.com/archives/259/a-complete-zenity-dialog-examples-1/</p>
<p>http://linux.byexamples.com/archives/265/a-complete-zenity-dialog-examples-2/</p>
<p>http://www.korben.info/integrer-une-popup-de-notification-dans-vos-scripts-sous-ubuntu.html</p>
</div><p>The post <a href="https://gagzen.net/2009/09/04/linux-gui-boites-de-dialogue/">Linux GUI : Boîtes de dialogue</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Connexion ssh sans mot de passe</title>
		<link>https://gagzen.net/2009/06/15/connexion-ssh-sans-mot-de-passe/</link>
		
		<dc:creator><![CDATA[Baptiste]]></dc:creator>
		<pubDate>Mon, 15 Jun 2009 14:31:27 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[ssh]]></category>
		<guid isPermaLink="false">http://www.gagneux.info/index.php/?p=108</guid>

					<description><![CDATA[<p>Pour créer une connexion ssh sans mot de passe. Sur le client : ssh-keygen -t rsa Un fichier /home/nagios/.ssh/id_rsa.pub est obtenu. Sur le serveur se connecter en nagios : mkdir .ssh vi ./.ssh/authorized_keys Copier le contenu du id_rsa.pub obtenu sur le client chmod 700 -R ./.ssh Tenter la connexion depuis le client ssh -v IP [&#8230;]</p>
<p>The post <a href="https://gagzen.net/2009/06/15/connexion-ssh-sans-mot-de-passe/">Connexion ssh sans mot de passe</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Pour créer une connexion ssh sans mot de passe.</p>
<p>Sur le client : <code><br />
ssh-keygen -t rsa</code></p>
<p>Un fichier /home/nagios/.ssh/id_rsa.pub est obtenu.</p>
<p>Sur le serveur se connecter en nagios :<br />
<code> mkdir .ssh<br />
vi ./.ssh/authorized_keys</code><br />
Copier le contenu du id_rsa.pub obtenu sur le client<br />
<code> chmod 700 -R ./.ssh</code></p>
<p>Tenter la connexion depuis le client<br />
<code>ssh -v IP</code> (le -v est le mode verbeux pour avoir plein de message en cas d&rsquo;échec)</p>
<p>Pour plusieurs serveurs, ne pas regénérer la clef (première partie).</p><p>The post <a href="https://gagzen.net/2009/06/15/connexion-ssh-sans-mot-de-passe/">Connexion ssh sans mot de passe</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Démarrage d&#8217;aMuled au boot</title>
		<link>https://gagzen.net/2009/06/15/demarrage-damuled-au-boot/</link>
		
		<dc:creator><![CDATA[Baptiste]]></dc:creator>
		<pubDate>Mon, 15 Jun 2009 14:30:08 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[WorkStation]]></category>
		<category><![CDATA[amule]]></category>
		<category><![CDATA[linux]]></category>
		<guid isPermaLink="false">http://www.gagneux.info/index.php/?p=106</guid>

					<description><![CDATA[<p>pré requis : Fedora, RHEL, Centos, SME7, &#8230; aMuled Startup script for RedHat (Fedora, RHEL, Centos, SME7, &#8230;) Run su, or prefix commands with sudo, to become root. Edit the USER= line to set it to your current user (as reported by whoami). Copy the script as /etc/init.d/amuled: cp amuled /etc/init.d/amuled Make it executable: chmod [&#8230;]</p>
<p>The post <a href="https://gagzen.net/2009/06/15/demarrage-damuled-au-boot/">Démarrage d’aMuled au boot</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></description>
										<content:encoded><![CDATA[<div>
<p><ins><strong>pré requis : </strong></ins></p>
<ul>
<li>Fedora, RHEL, Centos, SME7, &#8230;</li>
<li>aMuled</li>
</ul>
</div>
<div>
<h3><span id="more-251"></span></h3>
<h3>Startup script for RedHat (Fedora, RHEL, Centos, SME7, &#8230;)</h3>
<p>Run <em>su</em>, or prefix commands with <em>sudo</em>, to become root.</p>
<p>Edit the <em>USER=</em> line to set it to your current user (as reported by <em>whoami</em>).</p>
<p>Copy the script as <em>/etc/init.d/amuled</em>:</p>
<ol>
<li>cp amuled /etc/init.d/amuled</li>
</ol>
<p>Make it executable:</p>
<ol>
<li>chmod 755 /etc/init.d/amuled</li>
</ol>
<p>Then register the service :</p>
<ol>
<li>chkconfig &#8211;add amuled</li>
</ol>
<p>The alternate script contains the following lines :</p>
<pre><code>#!/bin/sh
# aMule - script shell pour l'arret/demarrage du service

# description: amule p2p download service
# chkconfig: 345 97 03

# Source function library.
. /etc/rc.d/init.d/functions

USER=p2p #A user who already ran amule once to configure it.

RETVAL=0

case "$1" in
start)
  echo -n "Starting amule daemon: "
  daemon --user=$USER amuled -f
  RETVAL=$?
  echo
  [ $RETVAL -eq 0 ] &amp;&amp; touch /var/lock/subsys/amule
  ;;
stop)
  echo -n "Stopping amule daemon: "
  killproc amuled
  RETVAL=$?
  rm -f /var/lock/subsys/amule &amp;&amp; rm -f /var/lock/amule
  echo
  ;;
status)
  status amuled
  RETVAL=$?
  ;;
restart|force-reload)
  $0 stop
  $0 start
  RETVAL=$?
  ;;
*)
  printf "Usage: %q {start|stop|status|restart|force-reload}\n" "$0" &gt;&amp;2
  exit 1
  ;;
esac

exit $RETVAL</code>
Source : http://www.amule.org/wiki/index.php/FAQ_amuled</pre>
</div><p>The post <a href="https://gagzen.net/2009/06/15/demarrage-damuled-au-boot/">Démarrage d’aMuled au boot</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>pure-ftpd &#8211; Black-list des bots</title>
		<link>https://gagzen.net/2008/12/29/pure-ftpd-black-list-des-bots/</link>
		
		<dc:creator><![CDATA[Baptiste]]></dc:creator>
		<pubDate>Mon, 29 Dec 2008 14:27:00 +0000</pubDate>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pure-ftpd]]></category>
		<category><![CDATA[syslogd]]></category>
		<guid isPermaLink="false">http://www.gagneux.info/index.php/?p=100</guid>

					<description><![CDATA[<p>pré-requis modification du syslogd pour que le log pure-ftpd soit /var/log/pureftpd/pureftpd_tmp.log #!/bin/sh # # # # Variables FICHIER_LOG= »/var/log/pureftpd/pureftpd_tmp.log » FICHIER_HOSTS_DENY= »/etc/hosts.deny » FICHIER_LOG_DEFINITF= »/var/log/pureftpd/pureftpd.log » ADRESSE_EMAIL= »barthoi@localhost » NB_TENTATIVES=`grep  « Authentication failed for user \[Administrator\] » $FICHIER_LOG &#124; wc -l` if [ « $NB_TENTATIVES » -gt « 2 » ] ; then IP_A_DENY=`grep  « Authentication failed for user \[Administrator\] » $FICHIER_LOG &#124; tail -1 &#124;cut -d « ) » -f1 &#124; cut [&#8230;]</p>
<p>The post <a href="https://gagzen.net/2008/12/29/pure-ftpd-black-list-des-bots/">pure-ftpd – Black-list des bots</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></description>
										<content:encoded><![CDATA[<div>
<p>pré-requis</p>
<ul>
<li> modification du syslogd pour que le log pure-ftpd soit /var/log/pureftpd/pureftpd_tmp.log</li>
</ul>
</div>
<div>
<p><span id="more-248"></span></p>
<p>#!/bin/sh<br />
#<br />
#<br />
#</p>
<p># Variables<br />
FICHIER_LOG= »/var/log/pureftpd/pureftpd_tmp.log »<br />
FICHIER_HOSTS_DENY= »/etc/hosts.deny »<br />
FICHIER_LOG_DEFINITF= »/var/log/pureftpd/pureftpd.log »<br />
ADRESSE_EMAIL= »barthoi@localhost »</p>
<p>NB_TENTATIVES=`grep  « Authentication failed for user \[Administrator\] » $FICHIER_LOG | wc -l`<br />
if [ « $NB_TENTATIVES » -gt « 2 » ] ; then<br />
IP_A_DENY=`grep  « Authentication failed for user \[Administrator\] » $FICHIER_LOG | tail -1 |cut -d « ) » -f1 | cut -d « @ » -f2`<br />
echo « ALL:$IP_A_DENY » &gt;&gt; $FICHIER_HOSTS_DENY<br />
echo « raison : pure-ftpd Authentication failed for user [Administrator] » |/bin/mail -s « Black-list de $IP_A_DENY » $ADRESSE_EMAIL<br />
fi<br />
cat $FICHIER_LOG &gt;&gt; $FICHIER_LOG_DEFINITF<br />
cat /dev/null &gt; $FICHIER_LOG</p>
</div><p>The post <a href="https://gagzen.net/2008/12/29/pure-ftpd-black-list-des-bots/">pure-ftpd – Black-list des bots</a> first appeared on <a href="https://gagzen.net">Gagzen</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
