Tag Archives: Howto

Bad hard drive noise on shutdown (HDD Park)

This should only be used as a temporary workaround
And has been tested to work on a Acer Aspire 5601AWLMi laptop with a 80GB IDE hard drive, but this work around may not work for everyone.

Create file:

sudo nano /etc/rc0.d/S00hdd-shutdown-workaround

which includes this two lines:

#!/bin/sh
echo 1 > /sys/class/scsi_disk/0\:0\:0\:0/stop_on_shutdown

Then make it executable:

sudo chmod +x /etc/rc0.d/S00hdd-shutdown-workaround

On the next shutdown it should park the hdd heads correctly.

Note:
If you have more than one directory at “/sys/class/scsi_disk/“, add another line for each of them in the S00hdd-shutdown-workaround file.

Cloned desktop on i945 using the i810 driver

Here is what i have added to my xorg.conf file to get cloned desktop working on my laptop.

In the
Section “Device”
……
EndSection

this is the extra i added

	Option		"MonitorLayout"		"CRT,LFP"
	Option		"Clone"			"True"
	Option		"DevicePresence"	"True"
	Option		"VBERestore"		"True"
	BusID		"PCI:0:2:0"

Remember before playing with your xorg.conf file to back it up

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

To see my xorg.conf file
Continue reading

Generating DSA or RSA SSH Keys

From: original link
Generating Keys
The first step involves the generation of a set of DSA or RSA keys for use in authentication. Typically, you would do this on the machine you intend to use for logging into all other machines, but this does not matter too much, as you can always move the keys around to other machines as needed.

To generate a set of DSA or RSA public/private keys, use the following command:

ssh-keygen -t rsa

or

ssh-keygen -t dsa

You will be prompted for a location for saving the keys, and a passphrase for the keys. When choosing the passphrase for the keys, pick a very strong passphrase, and remember, or note it in a secure place. This passphrase will be required to use the keys every time you need to login to a key-based system:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.

Locating the Keys on Remote Computers
Assuming the remote computers you wish to use the keys for have running ssh daemons already, then locating your public portion of the key pair on those machines is quite simple. For example, if you’d like to begin using key-based logins as user username on a remote machine named host, and host is running sshd, and reachable by name on your network, simply use the ssh-copy-id command to properly locate your key:

ssh-copy-id -i ~/.ssh/id_rsa.pub username@host

or

ssh-copy-id -i ~/.ssh/id_dsa.pub username@host

Testing the Login
Next, you need to test the login, by attempting a connection to the machine and using your passphrase to unlock the key:

ssh username@host

You will be prompted for the passphrase for your key:

Enter passphrase for key ‘/home/username/.ssh/id_rsa':

Enter your passphrase, and provided host is configured to allow key-based logins, you should then be logged in as usual.

Mount a remote filesystem via sshfs

sshfs is a file system client based on the SSH File Transfer Protocol. Since most SSH servers already support this protocol it is very easy to set up: i.e. on the server side there’s nothing to do. On the client side mounting the file system is as easy as logging into the server with ssh.

SERVER-SIDE
Install SSH Server:

sudo apt-get update
sudo apt-get install ssh

CLIENT SIDE
NOTE: Throughout this part of the tutorial, always replace username with your server’s username, and host with the IP Address or domain of your server.

Test your SSH connection to the server:

ssh username@host

If your connection was successful move on to the next step

Install sshfs:

sudo apt-get update
sudo apt-get install sshfs
sudo modprobe fuse

Configure your user to be a member of the FUSE group:

sudo adduser username fuse
sudo chown root:fuse /dev/fuse
sudo chmod +x /dev/fuse

Because a new user group has been created, we must now logout and back into the system. A reboot is not required.

When you have logged back in, we need to create a mount point within your home folder. It is important to note that the mount point must be within a folder owned by your user, so the safest place to put the mount point will be in your home directory.

mkdir ~/what_ever_you_like_to_call_this_directory

Let’s mount and test the remote file system:

sshfs username@host:/remote/dir/to/mount ~/what_ever_you_like_to_call_this_directory/

Now if all is successful you remote directory should be mounted. You should be able to type ls -lg in terminal or use you favorite file manager like nautalus to view the remote server mount point.

To unmount the remote file system:

fusermount -u ~/what_ever_you_like_to_call_this_directory/

Connecting to secure wireless network without authenticating against keyring manager

From : original link

By default, if a wireless network is secured by WPA or such, you have to save the info in your keyring manager, which is protected by a password.

Both session and keyring passwords must match for this to work, if they don’t match, you will be prompted to unlock the keyring.

1. Install libpam-keyring package :

$ sudo apt-get install libpam-keyring

2. Then tweak the GDM PAM (plugable authentication module) security

$ sudo gedit /etc/pam.d/gdm

Add the following line at the very end of that file, then save :

@include common-pamkeyring

3. Reboot and authenticate into your session, you should now be connected.

4. Optional : change your keyring password

$ /usr/lib/libpam-keyring/pam-keyring-tool -c

Password protecting your screen session

Don’t use your usual password, as the method used is pretty weak (standard DES)

Open a screen session :

$ screen

Inside the session press ctrl + a then type :password

If successfully set, you should see [ Password moved into copybuffer ] in the lower left corner of the terminal.

Now you can detach by pressing ctrl + a then d

Reattach with :

$ screen -r

And now you should be prompted for the session password.

Tuning the Linux kernel for more aggressive network throughput

Below is a snippet of what was forwarded to me via email from a friend, that was originally emailed out in the Builder AU newsletter on July 26th 2007. Hope people find it useful as I have, I have only tested the information below on a test box and was happy on the increase of throughput from that box. When i get a chance I’ll try to add couple before and after screenshots

The Linux kernel and the distributions that package it typically
provide very conservative defaults to certain network settings that
affect networking parameters. These settings can be tuned via the /proc
filesystem or using the sysctl program. The latter is often better, as
it reads the contents of /etc/sysctl.conf, which allows you to keep
settings across reboots.

The following is a snippet from /etc/sysctl.conf that may improve
network performance:

net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_syncookies = 1
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216

The above isn’t to replace what may already exist in /etc/sysctl.conf,
but rather to supplement it. The first command enables TCP window
scaling, which allows clients to download data at a higher rate by
enabling extra bits in TCP packets that are used to increase the window
size.

The second command enables TCP SYN cookies, which is often enabled by
default and is extremely effective in preventing conditions such as SYN
floods that can drain the server of resources used to process incoming
connections.

The last four options increase the TCP send and receive buffers, which
allow an application to move its data out faster so as to serve other
requests. This also improves the client’s ability to send data to the
server when it gets busy.

By adding these commands to the /etc/sysctl.conf file, you ensure they
take effect on every reboot. To enable them immediately without a
reboot, use:

# sysctl -p /etc/sysctl.conf

To see all of the currently configured sysctl options, use:

# sysctl -a

This will list all of the configuration keys and their current values.
The sysctl.conf file allows you to configure and save new defaults;
what you see from this output are the defaults defined in the kernel
that are currently effective. To see the value of one particular item,
use:

# sysctl -q net.ipv4.tcp_window_scaling

Likewise, to set the value of one item without configuring it in
sysctl.conf — and understanding that it won’t be retained across
reboots, use:

# sysctl -w net.ipv4.tcp_window_scaling=1

This can be useful for testing the effectiveness of certain settings
without committing them to being defaults.