Putty and tree – how to avoid weird characters (squares)

Character encoding is always a problem when communicating between Windows and Linux. And using the “tree” command is affected by this problem if you are connected to a Linux box using Putty on a Windows box. You will certainly get weird characters, probably squares.

For those who are not sure about what tree is. It is a command-line tool to list contents of directories in a tree-like format.

A solution to this problem is to force using plain ASCII characters:

tree --charset=ASCII

You can also have an alias for this command, so that every time you type “tree“, it will force tree to use the ASCII charset automatically.

alias tree='tree --charset=ASCII'

And this is an example of what you will get as an output:

/tmp
|-- claws-mail-1000
|-- keyring-x803mg
|   |-- control
|   |-- pkcs11
|   `-- ssh
|-- orbit-gdm [error opening dir]
`-- virtual-user

How to work around “prerequisite RT 0 not found” on Ubuntu

You installed Request Tracker 3.8 on Ubuntu 10.04 using apt-get, aptitude, or synaptic, and then you needed RT::Authen::ExternalAuth.

What you naturally did is:

sudo cpan -i RT::Authen::ExternalAuth

But you will get the following error:

prerequisite RT 0 not found

This is because you did not install request-tracker through CPAN.

An easy solution for this is to force the installation using the “-f” flag:

sudo cpan -fi RT::Authen::ExternalAuth

How to create a simple approval queue with Request Tracker (RT) 3.8

Introduction

In this post I will show how to create a simple approval queue in Request Tracker 3.8.

Request Tracker

The General queue will be used as the approval queue.

Here are the different entities (groups) we will create:

  • Submitters: they can submit new tickets only to the General Queue.
  • Approvers: they can approve tickets (move them from the general queue to another queue)

I will also show how to add a new dashlet (“RT at a glance“) containing all the tickets the user created (“My issues”).

Continue reading “How to create a simple approval queue with Request Tracker (RT) 3.8”

How to set up Expires header with Apache2 on Ubuntu Lucid 10.04

A very good way to reduce page load time on your website is to tell your visitors’ browser it can cache some specific files and save a copy on the disk.
This process is done by your web-server which is sending an Expires header and a max-age header during the HTTP response, e.g.:

200 OK
Cache-Control: max-age=604800
Connection: close
Date: Tue, 27 Jul 2010 22:31:03 GMT
Accept-Ranges: bytes
ETag: "2c956-376b-4696cb8b385c0"
Server: Apache/2.2.14 (Ubuntu)
Content-Length: 14187
Content-Type: image/gif
Expires: Tue, 03 Aug 2010 22:31:03 GMT
Last-Modified: Fri, 08 May 2009 20:46:23 GMT
Client-Date: Tue, 27 Jul 2010 22:31:02 GMT
Client-Peer: 127.217.30.5:80
Client-Response-Num: 1

Apache2 offers this feature through its mod_expires module. Note that this module is usually disabled by default, meaning your visitors would download all the files over again each time they change the page.

Continue reading “How to set up Expires header with Apache2 on Ubuntu Lucid 10.04”

Name-Based Virtual Hosts with SSL using Apache2 on Ubuntu Lucid

It has now been a few years (2007) that SNI (Server Name Indication) has been introduced/supported in OpenSSL 0.9.8, but it has only been just last year that SNI was fully supported in Apache2 with version 2.2.12 released in July 2009. Now we can really having
multiple virtual hosts with different certificates on the same IP address! No need to buy any more IP addresses!

Continue reading “Name-Based Virtual Hosts with SSL using Apache2 on Ubuntu Lucid”

How to backup MySQL users except root on Ubuntu

When you want to backup your mysql databases, you usually do mysqldump … –all-databases or mysqldump … –databases mysql … but you end up with the whole mysql table which is a pain to insert back when you need it because it can mess up the root password or the debian-sys-maint user…

If you wish to just backup all the users and privileges other than root and debian-sys-maint, you can use this command:

mysqldump -nt -uroot -p -w"User NOT LIKE 'root' AND User NOT LIKE 'debian%'" mysql user db > users_privs.sql

Here’s an explanation of each of the options:

  • -nt: Do not add “drop table” and “create table”.
  • -uroot -p: Connect as root and ask for a password
  • -w…: Add a “WHERE” condition to each query. We exclude everything related to root and debian-sys-maint.
  • mysql user db: Dump the user and db tables from the mysql database.
  • > users_privs.sql: Store the sql dump into the users_privs.sql file.

Things to remember to backup or copy when migrating servers

A new version of your operating system just got released and you want to have a fresh new install, or you want to migrate all of your data to another machine. There are so much stuff to backup that you don’t even know where to start?
I will try to list the most common stuff (on a web-server) to backup or copy somewhere when you want to do a server migration.

Continue reading “Things to remember to backup or copy when migrating servers”

How to enable VNC (Vino) on Ubuntu (Gnome)

The way I’m going to describe is using the GDM autologin which can be UNSECURE if someone has physical access to the machine.

Activate autologin in gdm by editing /etc/gdm/custom.conf and add:

AutomaticLoginEnable=true
AutomaticLogin=yourusername

Reboot.

Then ssh as yourusername into the machine, and type this:

DISPLAY=:0.0
gconftool-2 --type list --list-type string --set /desktop/gnome/remote_access/authentication_methods '[vnc]'
gconftool-2 -s -t bool /desktop/gnome/remote_access/prompt_enabled false
vino-passwd
gconftool-2 -s -t bool /desktop/gnome/remote_access/enabled true

Reboot.

Then try connecting to your machine using VNC.

Source: By Weboide in How do i install gnome on Debian and remote to it? [serverfault.com]
This post is Licensed under CC-BY-SA 2.5