23 December 2012

301. Building Mosquitto 1.0.5 on debian stable

Here's what I did in a chrooted Stable while writing up a reply for this post: http://forums.debian.net/viewtopic.php?f=10&t=90444

I've changed the commands a little bit from http://mosquitto.org/2012/11/making-mosquitto-packages-for-debian-yourself/ to be more faithful to my own style. Edit your /etc/apt/sources.list so that it has both stable and testing e.g.

deb http://ftp.au.debian.org/debian stable main
deb http://ftp.au.debian.org/debian testing main

and edit /etc/apt/preferences
Package: *
Pin: release a=stable
Pin-Priority: 990

Package: *
Pin: release a=testing
Pin-Priority: 800

Followed by

sudo apt-get update
sudo apt-get install build-essential python quilt libwrap0-dev libssl-dev devscripts python-setuptools
sudo apt-get install libssl-dev=1.0.1c-4 python3


Then

mkdir ~/tmp
cd ~/tmp
wget http://mosquitto.org/files/source/mosquitto-1.0.5.tar.gz -O mosquitto_1.0.5.orig.tar.gz
tar xvf mosquitto-1.0.5.orig.tar.gz
cd mosquitto-1.0.5/
wget http://mentors.debian.net/debian/pool/main/m/mosquitto/mosquitto_1.0.5-1.debian.tar.gz
tar xvf mosquitto_1.0.5-1.debian.tar.gz
debuild -us -uc
sudo dpgk -i ../*mosquitto*.deb


and you'll find the .debs in the parent folder.


Links to this page:
http://jtlog.wordpress.com/2013/01/04/raspberry-pi-mosquitto/

300. Briefly: Sharing a folder using SAMBA on Debian

I don't ever use samba, but it's not a bad thing to know how to set up in case you need to share files with someone using Windows in a pinch.

First install samba:
sudo apt-get install samba samba-common smbclient

To get a share up with samba, create an /etc/samba/smb.conf and stick the following in it:


[global]
workgroup=WORKGROUP
guest account=nobody
security=shared


[asharedfolder]
path=/home/lindqvist/shared
guest ok=yes
read only=no
writable=yes
browsable=yes
comment= SMB share

Restart samba:
sudo service samba restart

1. This is an insecure share i.e. <b>anyone can access it</> and edit everything.
2.. Also, by omitting "netbios name=  " you can use the IP address of the server as the hostname, but you could also specify e.g. "netbios name=niobium" and use that as the hostname in nautilus when you connect to the host server.

To set up a user- and password-based share, do



[global]
workgroup=WORKGROUP
security=user


[asharedfolder]
path=/home/lindqvist/shared
guest ok=no
read only=no
writable=yes
browsable=yes
comment= SMB share

You need to add and set the samba password, and enable the linux user you want to give access as well:
sudo smbpasswd -L -a -e lindqvist


There are a lot of other options that can be set. Two of the more interesting ones are probably

[asharedfolder]
createmask=0755
valid users=me myself irene

which means that any new files created in that share via samba gets chmod 755, and only the users me, myself and irene can connect.

But often a basic smb.conf is easier to manage and will do what you want it to.

22 December 2012

299. Briefly: Start autossh at boot on debian testing/wheezy

I have one of my work computers set up to create a reverse tunnel to my WRT54G router at home, so that by login in to my router at home and then connecting to localhost:19996 I can access my work network from home. The problem is that if I reboot my work computer remotely I need to make sure that it tries to recreate the reverse ssh tunnel.

The way to do that is by editing /etc/rc.local and putting the following in it:
su lindqvist -c 'autossh -N -f -M 29001 -R 19996:localhost:22 remoteuser@my.router.com' &

Make sure you put it before the line that says
exit 0

linqdvist is the user at on my work computer I want to be running the autossh, 19996 is the port I'll connect to on my home router to gain access to the ssh port on my work computer. Since I'm using WRT54G with Tomato the remoteuser is root, and I got my dns (remote hostname) as shown in this post: http://verahill.blogspot.com.au/2012/02/tomato-router-and-free-dns.html
It's that simple.