Define a printer on Ubuntu using CUPS

February 14th, 2011

Took me some time to find this out digging the Net, hence creating a note here.

Example with a Ricoh printer (but Ubuntu includes tons of drivers), network connected and listening on IP 192.168.1.10.

lpadmin -E -p<my printer name> -v socket://<my printer address> -P
/usr/share/ppd/openprinting/Ricoh/PS/Ricoh-Aficio_SP_4210N_PS.ppd.gz
-u allow:all
Then let’s make it default with command:
lpadmin -d <my printer name>
Enable it in CUPS with command:
cupsenable <my printer name>
And make it accepting print jobs with command:
accept <my printer name>
Once you’re done, you can test by echoing some text like:
echo "I am a Genius" | lpr -d
or printing files like:
lpr -d mytextfile.txt
Here a lot of additional cool settings.

How to make an Apple?

December 30th, 2010

…on the keyboard of a MacBook Pro?

Simply press Alt + Shift + 8 and you’ll get a… 

Happy New Year!

Upgrading ESXi 4.0 to 4.1 from CLI

November 8th, 2010

Today I successfully upgraded 4 ESXi hosts to VMware ESXi 4.1.

Since I do not have Virtual Center (they are mainly lab machines), I found very good hints about hot to do it from CLI via SSH.

And as usual, to avoid forgetting how I did it’s good moment to write down some notes about the process.

  1. First of all, access to your ESXi 4.0 with vSphere Client, power off all the VMs and put the host in maintenance mode.
  2. Second, from ESX console press ALT-F1 and type the word unsupported pressing <Enter> afterwards. Please note that you will not be able to see anything while you type. This is kind of secret word to enable Tech Support Mode (TSM) locally.
  3. It will prompt you for root’s password, after which you’ll get console shell access on ESXi. Now let’s enable SSH access to the machine.
  4. Vi the file /etc/inetd, search for ssh and remove the hash sign in front of the line:

    ssh      stream   tcp   nowait   root   /sbin/dropbearmulti   dropbear ++min=0,swap,group=shell -i –K60

  5. Find the process id of inetd and send a hiccup signal to it to reconsider updated configuration:

    ~ # pidof inetd
    4935
    ~ # kill -HUP 4935

  6. Access to the ESXi via SCP graphical interface (for example, using WinSCP.

  7. Locate datastore (normally under /vmfs/volumes/datastore-name) and create a directory there called, for example, upgrade-4.1

  8. Download the file upgrade-from-ESXi4.0-to-4.1.0-0.0.<somenumber>-release.zip from VMware Website and unzip it.

  9. Transfer the unzipped content into the directory you created on ESXi using scp.

  10. Access to ESXi host in SSH.

  11. Upgrade using commands:
    ~ # cd /vmfs/volumes/datastore1/upgrade-4.1
    ~ # esxupdate update –m metadata.zip

  12. Upgrade process will begin and conclude as shown below:
    image

  13. Reboot your ESXi

  14. Access with vSphere 4.1 client and exit from Maintenance mode.

  15. Restart your VMs.

Intro to Applescript

October 23rd, 2010

Note to self, because this is something I want to look at sooner or later… therefore I’ll post it here.

This looks like a very good intro tutorial: http://www.makeuseof.com/tag/learn-automate-mac-applescript-part-1-introduction/

Kudos to MakeUseOf!

Screenshotting in Mac

September 30th, 2010

Found out very nice shortcut thanks to friend of mine who knows Mac since longer time than me (at least the modern ones).
Press Shift+Command+4 to get a selection of the screen to be saved on desktop in PNG format instead of Screen Capture utility saving in TIFF.
Add Space Bar to select the whole window the mouse is on and save as PNG on desktop.
Very handy, hence not to self.

Open Security Architecture – Note to Self

August 27th, 2010

osa_logo_180x66This very well done and useful site has been done, among others, by a great ex-coworker I respect very much.

As a note-to-self, I’m placing it in my collection of useful tech tips since their library and documentation is more than useful.

And yes, I’m committing to participate there as well, although I don’t know when I’ll be able to send my first contribution.

But committmen is a start, right? ;)

Odd characters while copying from SMB mounted drive to local Linux folder

July 7th, 2010

Since this happened with filenames with euro sign or accented characters or dollar signs, the solution is to specify the mount options as follows:
smbmount -o iocharset=utf8 //servername/folder /mnt/localmountpoint

Adding bunch of users in Linux in batch mode

July 5th, 2010

As usual, the main source for writing articles here is a need I had and a solution I found ;)

This time the need was to add a series of users in a Linux system without repeating the command useradd one zirillion of times.

First, we need to populate a text files with details about the users we’re going to create.

Let’s assume the file is called myuserlist.txt (permissions 600) with the following syntax:

user1:password1:1001:510:My First Account:/home/user1:/bin/bash
user2:password2:1002:510:My Second Account:/home/user2:/bin/bash
user3:password3:1003:510:My Third Account:/home/user3:/bin/bash
user4:password4:1004:510:My Fourth Account:/home/user4:/bin/bash

Once you’re done with the list, proceed to add the users with the command:

newusers myuserlist.txt

After command is issued, check the results in the following files:

/etc/passwd
/etc/shadow
/etc/groups

Zeroshell displaying odd characters on serial terminal

June 29th, 2010

I’ve been recently fashioned by Zeroshell project, a very well documented project run by an italian guy who made a splendid job.

I tried to set it up on a VIA based appliance with Intel 1 Ghz processor and 1 Gb RAM, using 1 Gb Compact Flash and the image provided in download section of Zeroshell web site.

Everything went smooth, except that when I booted the appliance the BIOS information was displayed correctly, but as soon as Zeroshell boot started I saw crappy characters on screen.

After some investigation and some good hints from a friend, I found where the problem was and, as usual, here’s a tech note to avoid again this investigation in the future.

The issue was that appliance BIOS was set to redirect console to serial port with settings normally in use: 9600 bps, 8N1

…while Zeroshell defaults in its boot to more performing (but also less “default”) 38400.

Read the rest of this entry »

Automatically mounting a remote directory in Ubuntu using autofs + sshfs

May 27th, 2010

Memo to self…