SSH

3G modem not re-connecting in OpenWRT?

Since I reflashed my router (TP-Link WR1043ND) I found out that I didn't have to use my own usb_serial script to get my Huwaei E182e modem to work in OpenWRT (still running RC5) - it just worked out of the box!

The thing was though, that the modem sometimes would disconnect, and would not re-connect using "ifup wan" anymore. After authentication, the modem would hangup and I had to reboot the whole router - which could get rather irritating.

Today, I gave myself time to explore this issue, instead of using a ping script that rebooted the router if not answering, and I found this thread:
https://forum.openwrt.org/viewtopic.php?pid=159749#p159749

The user, mforkel had a solution that I think would resolve my issue (I'm actually posting this before I've tried it, since I'm not at home at the moment).

  1. Logon to your router using SSH or Telnet.
  2. Edit /etc/config/network. eg:
    $ nano /etc/config/network
  3. Now locate the wan interface, which is using your modem:
    config 'interface' 'wan'
            option 'ifname' 'ppp0'
            option 'proto' '3g'
            option 'service' 'umts'
            option 'apn' 'data.cell.com'
            option 'pincode' '1234'
            option 'device' '/dev/ttyUSB0'
            option 'username' 'danielholm'
            option 'password' 'inspire;)'
  4. Now add this row:
    option 'pppd_options' 'debug noipdefault'
  5. Save and reboot. Good to go!

Review: SparkleShare.

I have a lot of images, code projects, documents, game saves and such, and I want to take good care of them, especially my images - they are the most valuable possession I've got. That's why I need a simple and safe backup solution. Earlier I just had an external harddrive, but thats not simple, nor have the security that I need. That's why I used Dropbox for a while. It was rather cheap and had everything that I needed, except encrypted transfer and I didn't know what happened with them across the Atlantic Ocean. So I started to look for alternatives - safe, secure, encrypted and I also wanted them to be Open Source so that I could have it running on my own server. GNU/Linux support and a client for Android was also needed.

I found SparkleShare that seemed to be a great solution and had pretty much all that I needed: Open Source, using SSH, rather simple to set up on my own server, webui and an Android client. I started to use it and have been using it since late september, 2011. But...

SparkleShare uses Git to store files and keep a history of changes made to my files. Git is created by the same author as of the Linux kernel, Linus Torvald, and were created for the development of the Linux kernel. Keep revision history, a linear development with the possibility to maintain paralell development branches - version control. For this, it's perfect! I use Git for my project nowdays (I used Bazaar before). The company I work for has started to use it, too.

That Git is created to development of software does, however, not make it capable as storing files, in my opinion. Now I have 60GB+ of images from the past ten year of my life - that is not optimal for Git and it's version control. For the everyday user that want's a Dropbox alternative, this is really not the best solution. Perhaps for a person writing his/her Ph D, it would be great. But with a lot of files, which itself creates much data and uses a lot of storage, you dont need to have a history larger then the files/directory itself.

Installation
Installing SparkleShare (server) is pretty straight forward (I'll post a guide soon). Just install SSH, Git and a few other packages on your server, and you're good to go. This is a real plus. Also the client is also very easy to install. It comes with packages for most of the well used GNU/Linux distros, and also Mac OS X - not Windows yet. It's also to build from source. You just install the client, copy the SSH key to your server and start a guide to add your share.

But I'd say this is too hard for new users. Well, if you're already running your own server, I suppose it's not that hard, but using its own SSH keys - without a password - is not something I like to do. But that can also be taken care of, altough it also might be a little to hard for the faint of heart.

Installing the WebUI - that is necessary for the Android client - is a little harder. It has a strict dependancy of package version, which I've had som issues with. Once up and running, it is incredibly easy to add your Android device, just by scanning a QR code.
The Android client is somewhat a different project - the WebUI too - then SparkleShare. It works to download your stored files, not anything more. You can't upload any files, which I very much would like. Perhaps in an later version.

Usage
Once installed and up and running, SparkleShare takes care of your files. By using Git the files are compressed before uploaded, and the transer is safe by it's usage of SSH. But I'm not satisfied. It's hard to upload a lot of files. I wanted to upload all of my 60GB+ images at once, but SparkleShare didn't seem understand that I added the files. Instead I had to remove them and upload them seperately. It worked, but the compression takes a long time, and if the connection between server and client gets broken during upload, the compression has to be restarted. Also, as I was saying, having a history copy of the files on the client, takes of a LOT of storage space.
Smaller files, like my documents is no problem - of course since the're smaller.
With the Nautilus addon, it is easy to get back an old version of an edited file just by right clicking on it.

SparkleShare is just a indicator applet, which is simple and works great. Altough I would like to see some info about the sync, like transfer speed, which files, just like the Dropbox indicator. Also I miss sync over LAN, bandwith limit and being able to pause specific shares - ie. so that I can start SparkleShare to only sync my documents while in school, when I don't want to use up my battery and all of my CPU to compress my images.

Besides that, SparkleShare runs fine in the bakground. If I were to already have uploaded all of my images, the compression wouldn't take so much time, nor would it be as big of a problem, but the local Git history copy, and Git itself, makes it a little less of "fun".

Conclusion
SparkleShare is great for easy sync of small files, not for bigger ones. It's also great if you're developing some small software, which you don't really use Git for yet, but still want's the version controll and being able to upload it - automatically - to GitHub or perhaps your own Git server.

I would say that SparkleShare is not yet ready for daily use and to drop out of you Dropbox use, or alternative.

Git is simply not the best way to get people from the closed, you-dont-know-where-or-what-theyre-doing-with-your-files, clients like Dropbox, and start to use free and open source ones. For me, version controll is not as important as a simple and secure backup solution. I'd say SparkleShare using Rsync would be a better way of doing this.

Perhaps Rsync could be used together with a simple script that saves a deleted file for a while, before it's completely deleted. And perhaps having preferences to set which files/dirs needs to have version control.

I'm sorry to say that I'm leaving SparkleShare to find, or develop, a new backup solution not using Git.

Generera SSH-nycklar.

SSH är ett säkert sätt att administrera div. enheter och maskiner över terminal och kommandon. Men i standardutförande så används oftast bara lösenord. Ett alternativ till detta, som ökar säkerheten ytterligare, är att använda sig av publika nycklar. Dessa kan genereras för ett helt system på den dator, såväl som för enskilda användare.

Jag använder nycklar till alla mina servrar, routrar, mobiler, osv. och det tycker jag att du med ska göra. I detta korta avsnitt tänkte jag bara visa hur man genererar en såan nyckel för att du senare ska kunna använda den vid div. tillfällen och tjänster.

Det hela är väldigt enkelt:

Öppna en terminal och kör:
$ ssh-keygen -t rsa -b 4096


En förfrågan om vart du vill spara nycklarna kommer att dyka upp. Använd standardplatsen om du inte vet vad du gör.
Du kommer få en ytterligare förfrågan om passphrase. Detta är ett lösenord man har för att kunna låsa upp och använda nyckeln. Gör här som du själv vill, men det är säkrare att ha en passphrase.

Gratulerar, du har nu ett nyckelpar i .ssh/id_rsa.pub. Alltså mappen .ssh som finns i din hemmap och i den, filen id_rsa.pub

Mer info om SSH, nycklar osv. finner du här: https://help.ubuntu.com/community/SSH/OpenSSH/Keys

UPDATE: Lade till antalet bitar för extra säkerhet.