Monday, May 10, 2010

Chrooted SSH/SFTP

with these settings, works for me in Debian Lenny:

Be sure that this line in /etc/ssh/sshd_config exists:

Subsystem sftp internal-sftp

Chroot the user to his home:

ChrootDirectory %h

The owner of home must be root (mod 755).

These lines are important, otherwise the root user could not login into system:

Match User root
ChrootDirectory /

Restart the ssh process:

/etc/init.d/ssh restart



Thursday, April 8, 2010

Colored output in bash

Use escape sequences:

echo -e '\E[color1;color2mYour Text.'
(color1 is the foreground, color2 the background color)

Shell Scripting Syntax


  1. echo -e '\E[30m black \E[31mred \E[32mgreen \E[33myellow \E[34mblue \E[35mmagenta \E[36mcyan \E[37mwhite'
  2. echo -e '\E[30;41mblack on red'


Shell Scripting Syntax
  1. Color: Foreground: Background:
  2. ---------------------------------------------------------
  3. black 30 40
  4. red 31 41
  5. green 32 42
  6. yellow 33 43
  7. blue 34 44
  8. magenta 35 45
  9. cyan 36 46
  10. white 37 47

Tuesday, March 2, 2010

Ubuntu - If your desktop icons are disappeared, try this

Press Alt+F2 and type gconf-editor in window.

Then apps --> nautilus --> preferences

Make sure "show_desktop" is checked.

If it's checked then double click on it and hit ok.

Wednesday, February 24, 2010

Send test mail from command line with Sendmail

In shell run this command:

( echo subject: test; echo ) | sendmail -v -oi YOUR-EMAIL@ADDRESS.COM

MySQL - debian-sys-maint account

Find your debian-sys-maint password in /etc/mysql/debian.cnf.

Then use this command in Mysql shell:

GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' \
IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

Replace PASSWORD with your debian-sys-maint password.

Backup and restore debian/ubuntu package selection

If you are running Debian and have lost track of which packages you are running, it could be useful to get a backup of your currently installed packages. You can get a list by running:

dpkg --get-selections > debianlist.txt

This will put the entire list in debianlist.txt. You could then install the same packages on a different computer with:

dpkg --set-selections < debianlist.txt

You should bear in mind that you would also need to copy over configuration files from /etc when copying your system to a new computer.

To actually install the selections, use:

apt-get -u dselect-upgrade

Source: http://www.tuxradar.com/content/linux-tips-every-geek-should-know

Tuesday, February 16, 2010

Convert a ssh-keygen to putty format using puttygen

First install putty-tools:

apt-get install putty-tools


then use this command to convert ssh-key:

puttygen YOUR-KEY -o OUTPUTFILE.PPK

Monday, January 25, 2010

How-To: Find missing packages in Debian

apt-file is a command line tool for searching packages in Debian/Ubuntu repositories.
Unlike apt-cache search, apt-file can find files in uninstalled or can list the content of uninstalled packages.

First, we will install the apt-file package:

apt-get install apt-file

then we need to update database:

apt-file update

now we can query the database for myfile:

apt-file search FILENAME

Thursday, December 10, 2009

Find Windows LDAP Schema

Run this command:

adsiedit.msc

Connect to your Server and expand the tree to see it!!

Monday, November 16, 2009

Tuesday, October 27, 2009

View and change the Queue Lifetime in qmail

With this command you can see the Queue-Lifetime:

/var/qmail/bin/qmail-showctl | grep life

this returns the Lifetime in seconds. (Default is 604800 seconds or 7 days)

You can change this value by edit the queuelifetime file in /var/qmail/control:

echo 86400 > /var/qmail/control/queuelifetime

and then restart the Qmail:

/etc/init.d/qmail restart