Put these in ~/.ssh/config
They help with repetitive tasks and such
Host *
Compression yes
ForwardX11 yes
CompressionLevel 7
Cipher blowfish
ServerAliveInterval 600
ControlMaster auto
ControlPath /tmp/ssh-%r@%h:%p
StrictHostKeyChecking no
Host 100.7.*
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
Monday, July 28, 2014
Sunday, July 27, 2014
Kytronic Smart Booster 2
After thinking about this for almost 20 years, finally someone made one!
http://www.kytronik.com/sb2
Key features of Smart Booster2 include:
- Increases significantly acceleration and power
- Reduces mechanical stress and temperature at high-rpm
- Reduces gas consumption
- Plug-and-Play, simple to setup, no battery needed
- 16 ignition timing curves, tailored to your engine for best efficiency
- Protected under epoxy resin in a customized red ABS plastic case
http://www.kytronik.com/sb2
Here is a quick photo gallery of my install process and as a bonus I had to replace all of the wiring on the stator plate.

As it arrived, with free sticker!!

Old timing marks, I actually had it set more advanced than this as you can tell from the modified slots.

Real vintage wiring!

Reboot...

...with heat shrink

unit fitted (need to replace that dodgy looking coil though)
New timing Marks. My bike is kitted with a Polini so it likes to fire @ 2mm from BTDC, or around 18 degrees. This unit changes all that, it will advance it where it needs to then back it off at higher revs to lower temp, and smooth out the engine. I'm running a squish clearance of almost 2mm and I monitor the cylinder head temp so I feel comfortable running it at around 18 degrees advance at high revs, hopefully even in Sydney summer time.
Sunday, July 06, 2014
Getting rid of 4-stroking - The quest
Overview
In my last post I said that I had been trying to get rid of my scooters 4 stroking for over 10 years. It's actually quite a lot longer than that actually, and it's really starting to but me. I've decided to jot everything down in this blog in at attempt to make it less baffling (no pun intended) and possibly help anyone else that has a similar issue.In the last post I went over the port timing, this time I'll go over the carb jetting.
Descriptions of symptoms
The thing that I can't get my head around is that everything I read tells me that 4-stroking is due to being too rich (we actually the cause is that the scavenging effect of the 2 stroke process isn't getting a chance to work on the amount of gas in the cylinder, so we could look at retarding the timing - more on that later). The thing is, if I lean out the idle any more it is just too lean., very slow to die down to idle speed, uneven, no power to pull off. But if I get the mixture "just right", the idle is nice and constant at around 1500rpm. The problem is as soon as I am moving and I position the throttle "just" off idle, the engine 4-strokes.Current settings
I have a Dellorto 28 PHPB with a Ram-Air foam filter.Main - 128
Pilot - 55
Choke - 70
Slide - 60 (modified)
Needle - x2 (middle ring)
Atomiser - AV262
White float
Today I tried once again messing around with the air mixture, and took the air filter off to see if that was causing the bike to run rich off idle. Neither helped.
Next I retarded the timing by a couple of degrees to around 17 BTDC, this actually seemed to make the engine more rough in other places (which I can understand, the low down torque would be better with more advance, my variable timing module is on the way). Anyway, the timing retard didn't help the 4-stroking issue.
Conclusion
I'm beginning to think that all kitted Vespas do this.EDIT
I started to think that I might be overcompensating for the lean slide by an over rich idle mixture setting (it was around 3 turns out). The two circuits to overlap quite a lot, especially in higher idle screw settings.
So I changed my over lean 60 slide for a 50 (unmodified) and swapped the 55 pilot jet for a 50.
At first it was over rich everywhere, but I after some adjustment I was able to get the idle pretty nice, screw is around 2.5 turns out which is correct for the PHBH carb. Middle openings where very rich so I lowered the needle to it's most lean position (top notch).
The engine pulls well now and the 4 stroking is much better. It is still there though, but at least I know the engine is not too lean!
Depending on the weather I might need to change the atomiser for a AV260 and raise the needle right up but I want to play it safe for now.
I did a plug chop and it's nice and brown. Max CHT was 149 degrees C after a good WOT blat.
I'm hoping that the variable ignition timing unit will help even more.
EDIT 2
See next post when I finally solve this!
Wednesday, July 02, 2014
Vespa - Polini 208 Port timing
Port Timings
Background
Ever since I put a 60mm crank on scooter I have been suspicious that the port timing had been messed up. I remember about 10 years ago I rang Terry at Taff speed, when he was still alive, and he told me that I should stick with the 57mm crank. I had already put the long stroke crank in at that stage so I couldn't bear undoing all of the work (or money).
Symptoms
- Difficulty getting the low speed jetting right.
- Rough running just off idle (4 stroking)
Forward wind lots of years and I finally got a chance to take a proper look, hopefully anyone else with a similar kit will find my findings useful.
Current build
- PX200 engine
- Cast iron Polini 208 kit, port matched transfer ports in the casings.
- A Worb5 head machined for the long stroke crank (it has a 1.5mm squish and the plug is moved toward the centre).
- A 60mm racing crank
- SIP 1.5KG full size balanced racing flywheel
- 28mm Delorto
- SIP racing clutch (very nice)
- SIP clutch bearing actuator
- Max. CHT temp. 160 Degrees C
- Max compression 150psi (warm, WOT).
- Ignition timing 19 degrees BTDC
I was running the kit with no base gasket and no head gasket.
The squish was around 1.2mm which is about ideal for racing (Norris Ker recommends 1mm in his book).
The jetting was about right (apart from the 4 stroking bottom end, usually found due to being to rich). I've been playing with jetting and slide modifications for years and still not got it perfect.
Ignition timing was around 19 BTDC (or around 2.5mm piston movement).
Stock Polini port timings
"Apparently" the stock Polini kit has port timings of 123° transfers to 171°exhaust timing with the 57mm crankshaft, but that information does vary depending on where I find it on the web.
Another site said 161.2; 112.8; 21.2 which is miles off what I found and I do question.
My port timings
My initial port timings with this set up where:
- Exhaust port open: 262 degrees
- Transfer open: 238 degrees
- Transfer close:115 degrees
- Exhaust close: 91 degrees
The sums
Exhaust port open - Exhaust close = exhaust port duration
Transfer open - Transfer close = transfer duration
Exhaust port duration - exhaust port duration / 2 = Blowdown
- Exhaust duration: 171 degrees
- Transfer duration: 123 degrees
- Blowdown: 24 degrees
This is pretty much exactly what I had found the Polini 208 kit to be, so the long stroke hadn't really effected the port timing much, if at all. I did want to get the rough running sorted though so I elected (easy to vote when there is only one of you) to install the base gasket which did alter the port timings a little.

Piston just clearing the transfer port.

Finding TDC
Modified Port Timings
"To alter or not to alter"
I chose not to alter the height of the exhaust port, even though my calculations found that I my ports timings where very close to the edge of what is recommend. I put this down to Mr. Polini knowing best and left it there. Besides, I want a grunty engine for riding around town, I've given up on the super high revving 2 stroke scooters.
So all I ended up doing was cleaning up all of the ports up a bit, and installing a 0.3mm base gasket and a 0.7mm head gasket. This gave me the following set-up.
- Exhaust duration: 174 degrees
- Transfer duration: 125 degrees
- Blowdown: 24.5 degrees
- Squish clearance: 1.9 mm

Some greasy scribblings
I also backed off the ignition timing to 18 degrees BTDC
Test ride
With the slightly revised port timing, the relaxed ignition timing and the reduced compression the engine feels smoother across the rev range, and does tend to reach high revs more easily (not a surprise as I have marginally raised the port timings. Given the reduction in compression I was surprised it still pulls very well.
CHT measured at a MAX. of 151 degrees which is quite acceptable.
Conclusion
All in all it was worth while to go through this exercise, one to put my mind at rest about the timings, but also because the bike does go better.
It does still 4 stroke a little just off idle though...
Friday, November 22, 2013
ZFS Server build notes
ZFS Filesystem backup
Hostname | xxxx |
---|---|
OS | centos6.2 64 |
10GB | Yes |
MTU | 9000 |
IP Address | xx.xx.xx.xx |
VLAN | backup & archive |
Location | xxxxx |
Storage Layout
Device | Size | Type | Compression | Comments |
---|---|---|---|---|
Raid6_sys | 120GB | Raid6 | No | Hardware Raid on Adaptec Raid Card - 1 hot spare |
Raid_data | 2.5TB | Raid6 | No | Hardware Raid on Adaptec Raid Card - 1 hot spare |
SATA | 1TB | EXT4 | No | Clone of System |
RaidZFS | XXTB | ZFS | Yes | Main Backup Storage |
Installation Notes
- Centos requires the Adaptec module to be installed during the install process in order to see the local raid
- The Mellonx 10G card needs a drive compiled and installed (make sure gcc, make, rpm_build_tools etc is installed!). The install files are in the homedir of root.
- BIOS is password locked with password
- Adaptec Raid Controller is password locked with password
- Full yum update performed - 21.11.2013
- Mellonx En driver doesn't load on it's own at start up. Fix this by adding the following to /etc/rc.local - modprobe mlx4_en
- Installed Megacli to talk to the LSI raid controller - rpm -ivh MegaCli-8.07.08-1.noarch.rpm
- Disable selinux - it's not supported with zfs at the moment.
LSI Controller Admin
We will use MegaCLI to communicate with the LSI controller
lsi.sh help
The controller is set to mail alerts. This is done via the root crontab
00 */2 * * * /usr/local/bin/lsi.sh checkNemail
View enclosures
/opt/MegaRAID/MegaCli/MegaCli64 -EncInfo -aALL
Creating the raid0 devices to present each disk to the OS
i=0; while [ $i -le 23 ] ; do /opt/MegaRAID/MegaCli/MegaCli64 -cfgldadd -r0[8:${i}] WB RA Cached CachedBadBBU -strpsz512 -a0 -NoLog ; i=`expr $i + 1`; done i=0; while [ $i -le 23 ] ; do /opt/MegaRAID/MegaCli/MegaCli64 -cfgldadd -r0[9:${i}] WB RA Cached CachedBadBBU -strpsz512 -a0 -NoLog ; i=`expr $i + 1`; done
Note that the enclosure ID's are 8 and 9. We can find this doing.
/opt/MegaRAID/MegaCli/MegaCli64 -EncInfo -aALL
Check the status of the drives
lsi.sh status lsi.sh drives
Information on a disk (in this case Enclosure 8, disk 20)
/opt/MegaRAID/MegaCli/MegaCli64 -PDInfo -PhysDrv [8:20] -a0
Rebuild disk (in this case Enclosure 8, disk 20)
/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -Start -PhysDrv [8:20] -a0
Misc. commands
Enable controller alarm
/opt/MegaRAID/MegaCli/MegaCli64 -AdpSetProp AlarmEnbl -aALL
Disable controller alarm
/opt/MegaRAID/MegaCli/MegaCli64 -AdpSetProp AlarmDsbl -aALL
Good cheat sheet of MegaCLI commands: http://www.damtp.cam.ac.uk/internal/computing/docs/public/megacli_raid_lsi.html
Install ZFS
yum localinstall --nogpgcheck http://archive.zfsonlinux.org/epel/zfs-release-1-2.el6.noarch.rpm yum install dkms gcc make kernel-devel perl yum install spl zfs chkconfig zfs on
Create ZFS Raid
zpool create -f tank /dev/sdf /dev/sdg /dev/sdh /dev/sdk /dev/sdj /dev/sdi /dev/sdl /dev/sdn /dev/sdm /dev/sdp /dev/sdo /dev/sdq /dev/sdr /dev/sds /dev/sdt /dev/sdu /dev/sdv /dev/sdx /dev/sdw /dev/sdy /dev/sdz /dev/sdaa /dev/sdab /dev/sdac /dev/sdad /dev/sdae /dev/sdaf /dev/sdai /dev/sdah /dev/sdaj /dev/sdag /dev/sdal /dev/sdam /dev/sdak /dev/sdan /dev/sdaq /dev/sdao /dev/sdar /dev/sdat /dev/sdas /dev/sdav /dev/sdap /dev/sdau /dev/sdaw /dev/sdax /dev/sday zpool add tank spare /dev/sdd /dev/sdb zfs create tank/projects zfs set compression=lzjb tank/projects zfs set dedup=on tank/projects zfs set atime=off tank zfs set atime=off tank/projects
What is looks like
# zfs list NAME USED AVAIL REFER MOUNTPOINT tank 1.38M 164T 144K /tank tank/projects 136K 164T 136K /tank/projects
Common Tools
Check dedupe ratio
zpool get dedupratio tank
Snapshots
Running from cron
# ls -l /etc/cron.* |grep zfs -rw-r--r--. 1 root root 79 Nov 21 17:24 zfs-auto-snapshot.cron.daily -rw-r--r--. 1 root root 80 Nov 21 17:24 zfs-auto-snapshot.cron.hourly -rw-r--r--. 1 root root 81 Nov 21 17:26 zfs-auto-snapshot.cron.monthly -rw-r--r--. 1 root root 79 Nov 21 17:26 zfs-auto-snapshot.cron.weekly
These crons run
/usr/local/bin/zfs-auto-snapshot
Current snapshot schedule is to keep 12 months of snapshots. These are located in .zfs of each folder.
Display snapshots config
zpool get listsnapshots tank
List snapshots
zfs list -r -t snapshot -o name,creation tank zfs list -t snapshot
List space
zfs list -o space
Devices
Disk /dev/sdd: 4000.2 GB, 4000225165312 bytes
Disk /dev/sde: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdf: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdg: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdh: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdk: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdj: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdi: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdl: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdn: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdm: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdp: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdo: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdq: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdr: 4000.2 GB, 4000225165312 bytes
Disk /dev/sds: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdt: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdu: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdv: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdx: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdw: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdy: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdz: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdaa: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdab: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdac: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdad: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdae: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdaf: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdai: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdah: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdaj: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdag: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdal: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdam: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdak: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdan: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdaq: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdao: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdar: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdat: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdas: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdav: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdap: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdau: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdaw: 4000.2 GB, 4000225165312 bytes
Disk /dev/sdax: 4000.2 GB, 4000225165312 bytes
Disk /dev/sday: 4000.2 GB, 4000225165312 bytes)
Tuesday, November 19, 2013
Friday, November 08, 2013
Thursday, November 07, 2013
Monday, November 04, 2013
Stereo xorg.conf - Centos playback machine to a Barco DP90 using SDI
=== Playback Hardware ====
The playback machine in the theater is called rodoric. It has 2 SSD 500GB drives, hardware raided.
/dev/sda1 937G 614G 277G 69% /ssd
The graphics card is a Nvidia 4000. It has 3 connections, only two are in use at one time.
* In Mono mode it will use a DVI to the KVM extender, and a DVI to a DVI-Ramp which in turn converts it's signal to SDI into the Barco (Input A)
* In Stereo mode it will output Left and Right eye signals using both display ports through DVI into a single DVI-Ramp which in turn converts it's signals to SDI into the Barco (SDI input A and B)
Users can switch between Stereo and Mono using the xorgswitch file below.
=== Xorg Switch ===
Type xorgswitch in a terminal to switch between Stereo and Mono Display modesxorgswitch
#!/bin/bash
#switch the xorg files for stereo and regular playback
#v1.0 - Dylan Penhale 04-11-2013
X11PATH=/etc/X11
XORG3D=xorg.conf.rv.3d.WORKING.04.11.2013
XORG2D=xorg.conf.safe.31.10.2013
echo "1. Stereo Mode - Barco only"
echo "2. Mono - Barco and LCD display"
echo -n "Enter: [1 or 2]:"
read choice
if [ $choice -eq 1 ]; then
echo "Switching xorg to Stereo mode"
rm -rf $X11PATH/xorg.conf
cp $X11PATH/$XORG3D $X11PATH/xorg.conf
echo "Now restart X Server {Cntl+Alt+Backspace)"
exit 0
else
if [ $choice -eq 2 ]; then
echo "Switching xorg to Mono mode"
rm -rf $X11PATH/xorg.conf
cp $X11PATH/$XORG2D $X11PATH/xorg.conf
echo "Now restart X Server {Cntl+Alt+Backspace)"
exit 0
fi
fi
done
=== Stereo ===
/etc/X11/xorg.conf.rv.3d.WORKING.04.11.2013Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "Files"
FontPath "/usr/share/fonts/default/Type1"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from data in "/etc/sysconfig/keyboard"
Identifier "Keyboard0"
Driver "keyboard"
Option "XkbLayout" "us"
Option "XkbModel" "pc105"
EndSection
Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor0"
VendorName "Unknown"
ModelName "OEM DVI-Ramp2"
HorizSync 1.0 - 250.0
VertRefresh 10.0 - 250.0
ModeLine "2048x1080_24.00" 66.02 2048 2080 2280 2512 1080 1081 1084 1095 -hsync +vsync
Option "DPMS"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro 4000"
EndSection
Section "Screen"
# Removed Option "Stereo" "4"
# Removed Option "metamodes" "DFP-1: 2048x1080_24 +0+0, DFP-2: 2048x1080_24 +0+0; DFP-1: nvidia-auto-select +0+0, DFP-2: nvidia-auto-select +0+0"
# Removed Option "metamodes" "DFP-0: nvidia-auto-select +64+0, DFP-2: 2048x1080_24.00 +0+60; DFP-2: nvidia-auto-select +0+0"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "CIOverlay" "on"
Option "Overlay" "on"
Option "TwinViewOrientation" "Clone"
Option "ExactModeTimingsDVI" "TRUE"
Option "FlatPanelProperties" "Scaling = Native"
Option "TwinView" "1"
Option "nvidiaXineramaInfoOrder" "DFP-0"
Option "Stereo" "4"
Option "metamodes" "DFP-1: 2048x1080_24.00 +0+0, DFP-2: 2048x1080_24.00 +0+0; DFP-2: nvidia-auto-select +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection
Section "Extensions"
Option "Composite" "Disable"
Endsection
=== Mono ===
/etc/X11/xorg.conf.safe.31.10.2013Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "Files"
FontPath "/usr/share/fonts/default/Type1"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from data in "/etc/sysconfig/keyboard"
Identifier "Keyboard0"
Driver "keyboard"
Option "XkbLayout" "us"
Option "XkbModel" "pc105"
EndSection
Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Eizo S2411W"
HorizSync 31.0 - 76.0
VertRefresh 59.0 - 61.0
Option "DPMS"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro 4000"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "Stereo" "0"
Option "nvidiaXineramaInfoOrder" "DFP-0"
Option "metamodes" "DFP-0: 1920x1200 +0+0, DFP-2: 2048x1080_24 +1920+60"
SubSection "Display"
Depth 24
EndSubSection
EndSection
Sunday, October 06, 2013
Saturday, August 24, 2013
Friday, August 23, 2013
Find duplicates in bash
find_dupes.sh
#! /bin/bash
OUTF=rem-duplicates.sh;
echo "#! /bin/sh" > $OUTF;
echo "" >> $OUTF;
find "$@" -type f -print0 | xargs -0 -n1 md5sum | sort --key=1,32 | uniq -w 32 -d --all-repeated=separate | sed -r 's/^[0-9a-f]*( )*//;s/([^a-zA-Z0-9./_-])/\\\1/g;s/(.+)/#rm \1/' >> $OUTF;
chmod a+x $OUTF
Run the script:
./find_dupes.sh /path/to/check .\
Which will output a file called rem-duplicates.sh which can then be edited as you wish.
I stole this from here. Credit to Marco Fioretti, who in turn used code from J. Elonen
Friday, August 16, 2013
Getting started with Linux in VFX
Useful entry level reading for someone that's never used linux before....
http://www.creativecrash.com/tutorials/the-unix-shell-for-vfx-artists#tabs
Thursday, August 15, 2013
VFX pipeline diagram - real world example
Wednesday, August 14, 2013
How to setup a reverse ssh tunnel
Ever wanted to know how you can ssh into your work desktop/server? Well do not worry any longer.....
- All you need to do is create a reverse tunnel from your Work Desktop/Server to your home server.
- ssh -nNT -R 5000:local_server:22 username@remote_server
- Now from the remote_server run this
ssh -p5000 localhost.... now we are in our work desktop/server.
- Lets brake this down a bit..
- The -n option Redirects stdin from /dev/null. This must be used when ssh is run in the background.
- The -N option does not execute a remote command. This is useful for just forwarding ports.
- The -T option disables pseudo-tty allocation.
- The -R option does tha job of setting up the reverse tunnel.
- Port 5000 is the port that will be listening on the remote_server (this can be any random port over 1024, if you want to run this as a non-root user).
- local_server is the desktop/server that you are creating the connection from.
- Port 22 is the port that you are making the ssh connection to.
- user_name@remote_server is where you are making the ssh connection to for the reverse tunnel.
- In /etc/ssh/sshd_config we need to make sure this is set TCPKeepAlive yes.\
- We need to make sure we keep this connection open.
This page was stolen from somewhere else, I can't remember where. Sorry to the original author..
Running a script as root
The problem:
In theory, running a script as it's owner (in our case root) is simple, all you have to do is set the 'setuid' bit (sometimes mistakenly called the 'sticky' bit) by using 'chmod 4755' (or chmod 4***, depending on what mode you need). The problem is, that the 'setuid' bit functionality has been disabed on most Linux based distros for security reasons. This affects only scripts, not compiled code which should still work.
Solutions:
binary wrapper
The 'setuid' bit still works for compiled files. So what you can do is write a little c wrapper that will execute the script you want to run as root.
#include#include #include #include using namespace std; int main(int argc, char* argv[]) { setuid( 0 ); string cmd = "/opt/local/cmd.sh"; for (int i = 1; i < argc; i++) { string arg (argv[i]); cmd += " "; cmd += arg; } int exitcode; exitcode = system(cmd.c_str()); return WEXITSTATUS(exitcode); }
Safe this as 'runscript.c', then compile and do the following:
gcc runscript.c -o runscript sudo chown root:root runscript sudo chmod 4750 runscript
You should now be able to run this command as root.
sudo wrapper
Add the following line to your sudoers file, with 'group' being the group you want to give access to your script.
group ALL = NOPASSWD: /path/to/script
Then write a wrapper, executing you script with sudo.
sudo /path/to/script
Also your script will have to perform a 'setuid(0)' to make sure that all child processes are executed as root.
A couple of things to note:
- it's not enough to do 'chmod 4***' on the binary, you also have to use 'setuid' inside the code.
- an additional problem on Mac OS X is, that by default the 'setuid' bit is disabled on NFS mounts.
x forward session with xdmcp
XDMCP allows logging into a remote host, but displaying the desktop on your own host.
1) edit /etc.gdm/custom.conf
[xdmcp] Enable=true [security] DisallowTCP=false AllowRemoteRoot=true
2) restart X (telinit 3; telinit 5)
3) login as root and run:
gdmsetup
4) On the remote tab, change 'style' to 'same as local'
5) On the security tab, tick 'allow local system administrator login' and 'allow local system administrator login'
6) restart X
To test, log off your host, and press F10 in the login GDM login window. You can enter the name of the remote host to login too here.
Forward user x sessions
When logging into a remote host as root, you lose the ability to forward x sessions after an su to another user.
To allow x-forwarding after you perform an su, you need to request the cookie for the current server:
ssh root@somehost xauth list
returns:
somehost.somedomain/unix:10 MIT-MAGIC-COOKIE-1 d9fc3512df83a70ea8054dff21f58e28
Now, su to the user:
su - someuser xauth add somehost.somedomain/unix:10 MIT-MAGIC-COOKIE-1 d9fc3512df83a70ea8054dff21f58e28
now x apps will forward correctly - test with xterm.
Subscribe to:
Posts (Atom)