Everyone knows backups are important.
But usually everybody doesn't care much about them until an unrecoverable event happens.
So, why wait for that very moment, if, with a little bit of effort, you can have a rock solid data backup strategy.
A very good review on how to use the standard *nix rsync program to backup your valued electronic data.
Easy Automated Snapshot-Style Backups with Linux and Rsync
What is this blog about?
Mainly it is for my personal use. Is a collection of my job experience and are inteded to be notes for my memory just in case I need them again in the future.
That said I hope these tips could be useful for someone else too
Why in English?
I like foreign languages, English in particular. So, I consider this a sort of training for my English :-)
giovedì 11 marzo 2010
mercoledì 10 marzo 2010
Mac OS X print presets
Let's say you have a color laser printer installed in your system but you usually print in black and white.
It is very likely that the printer presets are in color.
So, every time you need to print a document, and you need it B/W, you have to go through the printer settings and choose the appropriate parameters.
That could eventually become annoying.
Yes, it is possible to create one or more personalized presets to choose from, before hitting the Print button, but that is not always the perfect solution.
There are programs, i.e. the MS Office suite, that have a nice little button with a printer, which sends the document directly to the print queue, bypassing the print dialogue screen.
If you want to modify the "Standard" presets there is a straightforward solution. Just fire up your browser and fill the URL bar with the address below or just click the link
http://localhost:631
It'll be presented the CUPS (Common UNIX Printing System) page. From there, you can change whatever you want regarding the printer or printers settings that will became the new defaults.
It is very likely that the printer presets are in color.
So, every time you need to print a document, and you need it B/W, you have to go through the printer settings and choose the appropriate parameters.
That could eventually become annoying.
Yes, it is possible to create one or more personalized presets to choose from, before hitting the Print button, but that is not always the perfect solution.
There are programs, i.e. the MS Office suite, that have a nice little button with a printer, which sends the document directly to the print queue, bypassing the print dialogue screen.
If you want to modify the "Standard" presets there is a straightforward solution. Just fire up your browser and fill the URL bar with the address below or just click the link
http://localhost:631
It'll be presented the CUPS (Common UNIX Printing System) page. From there, you can change whatever you want regarding the printer or printers settings that will became the new defaults.
sabato 16 maggio 2009
VNC screen scrambled
Many Apple servers out there are headless. That is particularly true for the ones before the advent of the Xserve with Intel processor.
And quite often, servers are managed remotely using software like the multitude of VNC server (GPL) or Apple Remote Desktop (commercial).
I personally choose Vine Server OSX Vnc to control a couple of Xserve. One with Panther server and the other one with Tiger server. This program has the advantage to handle international keyboard layout over the VNC server self contained in Tiger which can't.
I think I played around with Monitor Preferences because at some point logging into the VNC server presented a screen like this.

For some times I ended up quitting the VNC client and relaunching it again to get a comprehensible image. But that was very annoying.
So I did some internet searches and I found the solution to the problem removing the file
/Library/Preferences/com.apple.windowserver.plist
on the server side.
And quite often, servers are managed remotely using software like the multitude of VNC server (GPL) or Apple Remote Desktop (commercial).
I personally choose Vine Server OSX Vnc to control a couple of Xserve. One with Panther server and the other one with Tiger server. This program has the advantage to handle international keyboard layout over the VNC server self contained in Tiger which can't.
I think I played around with Monitor Preferences because at some point logging into the VNC server presented a screen like this.

For some times I ended up quitting the VNC client and relaunching it again to get a comprehensible image. But that was very annoying.
So I did some internet searches and I found the solution to the problem removing the file
/Library/Preferences/com.apple.windowserver.plist
on the server side.
domenica 3 maggio 2009
NT Backup and .bks file (reloaded)
The Windows program NT Backup can use a file with the extension .bks that contains the list of files or group of files to be saved.
As a matter of fact you can also use this file to exclude some files you don't want to be included into the backup set.
The syntax of the .bks file is as follows
X:\
This entire drive will be backed up.
X:\Folder_name\
Files in this folder will be backed up.
X:\Folder_name\ /exclude
Files in this folder will be excluded.
X:\File_name.ext
This file will be backed up.
X:\File_name.ext /exclude
This file will be excluded.
SystemState
The System State will be backed up.
\\Server\Share\Folder\
These network files will be backed up.
This file is normally created and managed by the program itself and it seems to be the only way to obtain a properly formatted .bks.
In fact, the .bks file is a "special" UNICODE file without the Unicode header (0xFFFE).
If you manually edit this file i.e. with NOTEPAD, the standard text editor included since the first version of Windows, and save it as a Unicode you are ruined. The scheduled backup job stop working.
It is very handy indeed to be able to manage that file as you like with your favourite text editor.
As long as you do that you need to strip the first two bytes (0xFFFE) off the .bks.
A simple way is to use a hexadecimal file editor.
Below you'll find some links to a few Hex Editor programs
Windows
Hex Editor XVI32
Mac OS X
HexEdit
Linux
Midnight Commander
As a matter of fact you can also use this file to exclude some files you don't want to be included into the backup set.
The syntax of the .bks file is as follows
X:\
This entire drive will be backed up.
X:\Folder_name\
Files in this folder will be backed up.
X:\Folder_name\ /exclude
Files in this folder will be excluded.
X:\File_name.ext
This file will be backed up.
X:\File_name.ext /exclude
This file will be excluded.
SystemState
The System State will be backed up.
\\Server\Share\Folder\
These network files will be backed up.
This file is normally created and managed by the program itself and it seems to be the only way to obtain a properly formatted .bks.
In fact, the .bks file is a "special" UNICODE file without the Unicode header (0xFFFE).
If you manually edit this file i.e. with NOTEPAD, the standard text editor included since the first version of Windows, and save it as a Unicode you are ruined. The scheduled backup job stop working.
It is very handy indeed to be able to manage that file as you like with your favourite text editor.
As long as you do that you need to strip the first two bytes (0xFFFE) off the .bks.
A simple way is to use a hexadecimal file editor.
Below you'll find some links to a few Hex Editor programs
Windows
Hex Editor XVI32
Mac OS X
HexEdit
Linux
Midnight Commander
sabato 24 gennaio 2009
Ubuntu, how to regenerate OpenSSH host keys
First, change directory to /etc/ssh
cd /etc/ssh
now, remove the old rsa and dsa keys files
sudo rm ssh_host_*
Generate new keys
sudo dpkg-reconfigure openssh-server
If you wanto to be 100% sure that the server you are connecting to is the one it claims to be, take note of the RSA and DSA fingerprint
sudo ssh-keygen -l -f ssh_host_rsa_key
sudo ssh-keygen -l -f ssh_host_dsa_key
to check against the fingerprint displayed next time you are going to connect.
Last, update your known_hosts file
~/.ssh/known_hosts
removing the line that contains the old reference, otherwise you'll get the following message
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
cd /etc/ssh
now, remove the old rsa and dsa keys files
sudo rm ssh_host_*
Generate new keys
sudo dpkg-reconfigure openssh-server
If you wanto to be 100% sure that the server you are connecting to is the one it claims to be, take note of the RSA and DSA fingerprint
sudo ssh-keygen -l -f ssh_host_rsa_key
sudo ssh-keygen -l -f ssh_host_dsa_key
to check against the fingerprint displayed next time you are going to connect.
Last, update your known_hosts file
~/.ssh/known_hosts
removing the line that contains the old reference, otherwise you'll get the following message
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
venerdì 16 gennaio 2009
Stop VMware Fusion to automatically map shared folders
If your Windows XP virtual machine under VMware Fusion (v2) insist to map the shared folder as unit Z: and creates a shortcut on the desktop you must edit the relative .vmx file.
Usually this file is hidden under the following directory
/Users/YourUserName/Documents/Virtual Machines/YourWinVMName.vmwarevm
Find and change to FALSE the following keys
hgfs.mapRootShare = "TRUE"
hgfs.linkRootShare = "TRUE"
The first one is in charge to map the share without your intervention, so that when you open up My Computer you magically find a Z: unit.
The last one tells Fusion to create a shortcut on the desktop.
Usually this file is hidden under the following directory
/Users/YourUserName/Documents/Virtual Machines/YourWinVMName.vmwarevm
Find and change to FALSE the following keys
hgfs.mapRootShare = "TRUE"
hgfs.linkRootShare = "TRUE"
The first one is in charge to map the share without your intervention, so that when you open up My Computer you magically find a Z: unit.
The last one tells Fusion to create a shortcut on the desktop.
sabato 27 dicembre 2008
Mutt and nbSMTP
Not so long ago I installed in different locations a few PCs as servers.
I choose Ubuntu server edition 8.0.4 LTS (Long-Term Support) aka Hardy Heron, the latest LTS version available from Canonical.
I prefer the hard way, without the GUI. Sorry, I don't like Linux GUIs ;-)
That way I can control what is installed, and install just what is really useful for that particular machine, leaving precious resources to services that need them. There is also another advantage. Limiting possible security issues.
One of these servers, in particular, has to manage the nightly backup of another server, this time a Windows 2003, via rsync.
I created a bash script to do the job and scheduled it with crontab.
The script, during the process, creates a report that is saved as a zip archive when the work is finished.
I was wondering how could I get that file to check everything was fine, without remotely access the server.
The obvious response was. By e-mail.
I started hunting for information in search for the most elegant solution with the minimum impact on the system.
What I found, and I picked, to achieve my goal, are these two little gems.
Mutt "a small but very powerful text-based mail client for Unix operating systems" and No Brainer SMTP nbSMTP "a simple MTA to send your mails to another mail server via SMTP".
First step. Retrieve and install the two packages. In Ubunto the apt-get command is aimed at that.
sudo apt-get install mutt
sudo apt-get install nbsmtp
I created a user specific .muttrc containing these lines
# No need to keep copy of the outgoing messages
set copy=no
# Some changes to the message headers
set hdrs=yes
my_hdr From: Me the sender <me@mydomain.com>
# How to invoke nbsmtp
set sendmail="/usr/bin/nbsmtp -f me@mydomain.com -d mydomain.com -h my_isp_smtp_server.com"
and to complete the work, at the end of the bash script that is supposed to make the backup, I've added the line in charge of sending the message
mutt -s "Backup report" -a report.zip me@mydomain.com < messagebody.txt
"Backup report" - is the subject of the message (option -s)
report.zip - is the attachment (option -a)
me@mydomain.com - is the recipient
messagebody.txt - is the main body of the e-mail (read message from the file messagebody.txt)
The file messagebody.txt could be anything you want to insert as the body of the message being sent.
Last but not least :-) I've also inserted this line into crontab file
MAILTO=""
to avoid error warning in log file
nbSMTP does not support the -o arguments from sendmail, ignoring them
because every time a croned job is executed mail is sent to the owner of the crontab
I choose Ubuntu server edition 8.0.4 LTS (Long-Term Support) aka Hardy Heron, the latest LTS version available from Canonical.
I prefer the hard way, without the GUI. Sorry, I don't like Linux GUIs ;-)
That way I can control what is installed, and install just what is really useful for that particular machine, leaving precious resources to services that need them. There is also another advantage. Limiting possible security issues.
One of these servers, in particular, has to manage the nightly backup of another server, this time a Windows 2003, via rsync.
I created a bash script to do the job and scheduled it with crontab.
The script, during the process, creates a report that is saved as a zip archive when the work is finished.
I was wondering how could I get that file to check everything was fine, without remotely access the server.
The obvious response was. By e-mail.
I started hunting for information in search for the most elegant solution with the minimum impact on the system.
What I found, and I picked, to achieve my goal, are these two little gems.
Mutt "a small but very powerful text-based mail client for Unix operating systems" and No Brainer SMTP nbSMTP "a simple MTA to send your mails to another mail server via SMTP".
First step. Retrieve and install the two packages. In Ubunto the apt-get command is aimed at that.
sudo apt-get install mutt
sudo apt-get install nbsmtp
I created a user specific .muttrc containing these lines
# No need to keep copy of the outgoing messages
set copy=no
# Some changes to the message headers
set hdrs=yes
my_hdr From: Me the sender <me@mydomain.com>
# How to invoke nbsmtp
set sendmail="/usr/bin/nbsmtp -f me@mydomain.com -d mydomain.com -h my_isp_smtp_server.com"
and to complete the work, at the end of the bash script that is supposed to make the backup, I've added the line in charge of sending the message
mutt -s "Backup report" -a report.zip me@mydomain.com < messagebody.txt
"Backup report" - is the subject of the message (option -s)
report.zip - is the attachment (option -a)
me@mydomain.com - is the recipient
messagebody.txt - is the main body of the e-mail (read message from the file messagebody.txt)
The file messagebody.txt could be anything you want to insert as the body of the message being sent.
Last but not least :-) I've also inserted this line into crontab file
MAILTO=""
to avoid error warning in log file
nbSMTP does not support the -o arguments from sendmail, ignoring them
because every time a croned job is executed mail is sent to the owner of the crontab
Iscriviti a:
Post (Atom)