Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Prevent SSH session from timing out

In
/etc/ssh/ssh_config

Set
ServerAliveInterval 120

SSH Tunnelling

Creating a tunnel via a gateway or 'jump off' server to a target server:

ssh -f -N -L 10022:target-host:22 user-on-gateway@gateway

-L sets up the tunnel from local port 10021 to remote port 21
-N no command, simply tunnel
-f run in the background

gateway and target are both server hostnames.

Then sign in the the taget server:

ssh -p 10022 user-on-target@localhost

Creating a SOCKS proxy via a gateway

ssh -D8888 user-on-gateway@gateway

Then you can use localhost:8888 as the proxy for any application that supports SOCKS, e.g. a browser.

Finding large files in Linux

To find file larger than 1 gig.

sudo find / -xdev -size +104857600c

Finding large files on a partition


#This command finds file larger than 1 gig.
sudo find / -xdev -size +104857600c

A few basic network commands on Linux

A few basic network commands for the benefit of my friend who's just installed Ubuntu on his laptop...

To see what id you're wireless card has got:
iwconfig

Then to restart the interface (change the eth1 id to match your system):
sudo ifdown eth1
sudo ifup eth1

This should kick things into life. However if you still don't get an IP address from the router try:
sudo dhclient

Vim cheatsheet


Link

http://www.viemu.com/vi-vim-cheat-sheet.gif


Vim settings

Useful .vimrc settings:


set smartindent
set autoindent
set shiftwidth=2
set showmatch
set ruler
set incsearch
set noshowcmd
set vb
syntax on

Configure Debian on NSLU2 to ensure disks spin down when inactive



A few config changes are needed to allow the Slug's external USB HD to spin down when not in use.

syslogd
Change the option in this file to stop the 'mark' entries being written to the message log.

/etc/default/syslogd

Option is...
SYSLOGD="-m0"

An -m value of zero turns marking off.

Check in here that marks are no longer written...
/var/log/messages

fstab mods
Add noatime to the mount options in /etc/fstab and put /var/run into RAM.

e.g.
/dev/sda1 / ext3 defaults,noatime,errors=remount-ro 0 1
tmpfs /var/run tmpfs defaults,size=512k 0 0

sdparm
As well as waiting for the disk to spin down you can also stop it manually with the sdparm command.

sdparm --command=stop /dev/sda

NSLU2 Page