ha ha bonk!!

26/08/2008

Linux tutorial #56: sudo

To help you get your head round the command “sudo”, there’s an excellent example of its usage below:

The cartoon is from the webcomic xkcd.com.  For your homework assignment go check it out!  The cartoon on the front page today (26 Aug) is funny too.  If you don’t get it, google “2 girls 1 cup”… or is it “1 cup 2 girls”?  Whatever, once you’ve seen it you’ll wish you hadn’t!


Some Common Linux Commands

16/07/2008

Linux has a well-developed graphical user interface – in fact it has several GUIs, the most popular of which are Gnome (on which Ubuntu is based) and KDE (Kubuntu‘s desktop).  But Linux also has a powerful command-line interface – also known as the console or terminal – and a great many commands to use in the CLI.

Here’s a little “cheat sheet” of common, basic Linux commands – just to get you started – you’d be wise to study this subject further if you’re serious about administering a Linux box.

Moving around in the file system
Command Action
pwd “Print working directory” – show what dir you’re in.
ls List the contents of a dir.
ls -l List the contents of a dir and show additional info of the files.
ls -a List all files, including hidden files.
cd Change directory.
cd .. Go to the parent directory.
Examining files
Command Action
file Determine the type of a file.
cat Concatenate a file.
less View text files and paginate them if needed.
Manipulating files and directories
Command Action
cp Copy a file.
cp -i Copy a file and ask before overwriting.
cp -r Copy a directory with its contents.
mv Move or rename a file.
mv -i Move or rename a file and ask before overwriting.
rm Remove a file.
rm -r Remove a directory with its contents.
rm -i Ask before removing a file. Good to use with the -r option.
mkdir Make a directory.
rmdir Remove an empty directory.

Linux Tutorial: How to use a cellphone as a modem

15/02/2008

avatar666.pngavatar666.pngavatar666.pngavatar666.png

Note: There is more up-to-date info on this subject, especially concerning mobile broadband HSDPA modems and 3G cellphones, to be found here. But the info on this page is still relevant. In particular, this page covers the program wvdial, which can be used if your network manager doesn’t detect your HSDPA modem.

I learnt how to connect to the internet through my cellphone because it was the only way I could get online from my home – at the time I was living in a flat where I wasn’t permitted to have a regular phoneline installed. And I still sometimes find it useful: if I’m out and about with my laptop, and I can’t find a wifi “hotspot” to use, I can generally get a GSM signal – in the UK it’s possible to get a signal in just about every urban area, and in a lot of rural areas too – and a GSM signal means you can connect to the internet via GPRS.

Some mobile service plans charge for internet access on a per MB of transferred data basis. This can turn out very expensive, as there is a lot of data transferred during an internet session. Especially if you download a 3 GB movie DVD!! However, many mobile plans charge a set fee for unlimited net access. My mobile provider, Orange, charge me £1 for one day’s unlimited access or £5 for a week’s access. And I believe in the USA it’s much cheaper.

So how do you use a mobile phone as a modem? With Windows, I haven’t got a clue. But with Linux, you establish a PPP connection with the mobile service provider’s servers, by using a dialler like wvdial. Wvdial comes included with a default installation of Ubuntu (my particular distro) and probably other Linux flavours too.

Connect your phone to the computer. I do this with a USB datacable that came with the phone, but some people use Bluetooth. The phone should be ON. My phone is a Sony Ericsson – when it’s linked to the computer, I have to choose between File Transfer and Phone Mode. To use the phone as a modem, I have to select Phone Mode. However, I sometimes use a Nokia phone, and there’s no mode-choosing necessary with that model.

Open a terminal and get yourself root status. Then type in the command

wvdialconf

This will cause wvdial to scan the computer for modems. You’ll get output something like this:

root@x-box:~# wvdialconf

Scanning your serial ports for a modem.

ttyS0<*1>: ATQ0 V1 E1 — failed with 2400 baud, next try: 9600 baud
ttyS0<*1>: ATQ0 V1 E1 — failed with 9600 baud, next try: 115200 baud
ttyS0<*1>: ATQ0 V1 E1 — and failed too at 115200, giving up.
Modem Port Scan<*1>: S1 S2 S3
WvModem<*1>: Cannot get information for serial port.
ttyACM0<*1>: ATQ0 V1 E1 — OK
ttyACM0<*1>: ATQ0 V1 E1 Z — OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 — OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 — OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 — OK
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 — OK
ttyACM0<*1>: Modem Identifier: ATI — Sony Ericsson W300
ttyACM0<*1>: Speed 4800: AT — OK
ttyACM0<*1>: Speed 9600: AT — OK
ttyACM0<*1>: Speed 19200: AT — OK
ttyACM0<*1>: Speed 38400: AT — OK
ttyACM0<*1>: Speed 57600: AT — OK
ttyACM0<*1>: Speed 115200: AT — OK
ttyACM0<*1>: Speed 230400: AT — OK
ttyACM0<*1>: Speed 460800: AT — OK
ttyACM0<*1>: Max speed is 460800; that should be safe.
ttyACM0<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 — OK

Found an USB modem on /dev/ttyACM0.
/etc/wvdial.conf<Warn>: Can’t open ‘/etc/wvdial.conf’ for reading: No such file or directory
/etc/wvdial.conf<Warn>: …starting with blank configuration.
Modem configuration written to /etc/wvdial.conf.
ttyACM0<Info>: Speed 460800; init “ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0”
ttyACM1<Info>: Speed 460800; init “ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0”
root@x-box:~#

[Note: I’ve edited the output, to cut down on its length.]

Wvdial found my cellphone (“Modem Identifier: ATI — Sony Ericsson W300”), and reports that the phone is on port ttyACM0.

Then wvdial created a configuration file (/etc/wvdial.conf) and put some config info about the phone in it.

Edit /etc/wvdial.conf with your mobile service provider’s information. When I ran wvdialconf, the program created a wvdial.conf file as below:

root@x-box:~# cat /etc/wvdial.conf

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
; Phone = <Target Phone Number>
ISDN = 0
; Username = <Your Login Name>
Init1 = ATZ
; Password = <Your Password>
Modem = /dev/ttyACM0
Baud = 460800

The program filled in some fields, but some have been left for you to do: specifically, the info needed to log in to your mobile service provider’s web servers. I edited the file to look like this:

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = USB Modem
Phone = *99#
ISDN = 0
Username = A
Init1 = ATZ
Password = B
Modem = /dev/ttyACM0
Baud = 460800
Stupid Mode = Yes

The number in the Phone field is the number that the phone needs to call to access my mobile provider’s GPRS service. Your mobile network may use a different number – you’ll have to ask them.

My mobile network does not require usernames and passwords to access the web servers. But wvdial doesn’t like empty fields. So I put “A” and “B” in them.

I added the last line: Stupid Mode = Yes, otherwise wvdial will simply cycle when run without ever connecting.

*IMPORTANT* All the output recreated above is from a system that did not have any other modems connected. Most laptops have a modem or network card built-in, which wvdialconf will detect. But you’ll be able to see what information relates to your phone, and edit your wvdial.conf file accordingly.

So, now you can connect to the internet. To do this, open that terminal and, as root, type in the command

wvdial

You’ll get output like this:

root@x-box:~# wvdial
WvDial<*1>: WvDial: Internet dialer version 1.56
WvModem<*1>: Cannot get information for serial port.
WvDial<*1>: Initializing modem.
WvDial<*1>: Sending: ATZ
WvDial Modem<*1>: ATZ
WvDial Modem<*1>: OK
WvDial<*1>: Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
WvDial Modem<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
WvDial Modem<*1>: OK
WvDial<*1>: Modem initialized.
WvDial<*1>: Sending: ATDT*99#
WvDial<*1>: Waiting for carrier.
WvDial Modem<*1>: ATDT*99#
WvDial Modem<*1>: CONNECT
WvDial Modem<*1>: ~[7f]}#@!}!}!} }8}#}$@#}(}”}’}”}”}&} } } } }%}&}$AUSgn~
WvDial<*1>: Carrier detected. Starting PPP immediately.
WvDial<Notice>: Starting pppd at Wed Jan 16 15:45:03 2008
WvDial<Notice>: Pid of pppd: 10689
WvDial<*1>: Using interface ppp0
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: local IP address 172.23.108.122
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: remote IP address 194.33.25.101
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: primary DNS address 193.36.81.37
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: secondary DNS address 193.36.81.38
WvDial<*1>: pppd: ��[06][08]��[06][08]

The program will appear to “hang” – the above text will just freeze on the monitor. But wvdial is actually holding the connection open until you terminate the link by hitting Ctrl-C.

Now you can use the connection by, for example, starting up your web browser; or open another terminal and run telnet or ssh, or do whois or ping commands. All these activities will run a lot slower than you’re used to – but they will run.

When you’re finished, hit Ctrl-C and wvdial will end with a closing message like this:

Caught signal 2: Attempting to exit gracefully…
WvDial<*1>: Terminating on signal 15
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: Connect time 0.8 minutes.
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: pppd: ��[06][08]��[06][08]
WvDial<*1>: Disconnecting at Wed Jan 16 15:45:50 2008
root@x-box:~#

Data connections via GPRS over GSM are very slow – mine often average about 5 K/sec. But 3G/UMTS is much faster. Nowhere near the performance over a landline, of course, but 3G will probably be the best bet. However, be warned: some mobile providers don’t like their customers to link to the internet this way, and I’ve been told that 3, a UK company, actively prevent it. Their customers can pay extra to get a GPRS modem, but linking a normal cellphone on a standard plan is not permitted. Tmobile also don’t like their customers to use their phones as modems. So beware! Or, better yet, use a network that doesn’t have such stupid rules!!

_gos=’c4.gostats.com’;_goa=354450;
_got=2;_goi=2;_goz=0;_gol=’Free hit counter’;_GoStatsRun();
Free hit counter
Free hit counter


Microsoft loses Euro court appeal

17/09/2007

Ohh man, this is so sweeeet!! If you’re a lover of freedom, that is. If you think the rich and powerful should be allowed to do what they like, when they like, to whoever they like, then you may be dismayed. But the news, which I got from this BBC link, is good news to anyone whose opinion means anything to me.

If you don’t know the details of the case, I’ll give you the basics. In 2004, the European Commission decided that Microsoft was acting in an anti-competitive manner – for instance, if you bought their Windows operating system software, you had to buy their media player too. This made the market ridiculously stacked against the other manufacturers of media players. Player XYZ might be much better than Microsoft’s offering – and Microsoft’s products are notorious for their poor quality – but if you already had Microsoft’s media player (which you would, if you’d bought Windows) then you’d be less keen to shell out for another. If multimedia was of great importance to you, you’d make the sacrifice of effectively paying twice so you’d have a decent experience. But if you were one of the many customers who thought they’d just make do with the crap that had been forced on them rather than pay again… well, it’s obvious. Just as it was to the European Commission.

And if you were one of the discerning consumers who decided to do without any of Microsoft’s crapware… well, Microsoft had a trick up its evil sleeve for you too. Now that so much business is done online, your computer is likely to have to communicate with computers that are running Windows. But if your computer wasn’t running Windows as well, the two systems couldn’t interoperate properly. Microsoft built incompatibilities into its operating system. And Microsoft refused to tell its competitors how they might be able to adapt their own product to interoperate with the Windows rubbish. “Trade secrets,” said Microsoft. “Bullshit,” replied the EC.

So in 2004, after thoroughly investigating Microsoft’s business practices, the EC ordered the software company to stop this anti-competitive behaviour. And the Commission fined Microsoft for every day that the company refused to obey the law – fines that added up to over 280 million euros in six months!

Of course Microsoft appealed. They couldn’t just start obeying the same laws that their competitors had to. Microsoft’s entire business strategy is built on the concept of forcing everyone to buy their products – the infamous “Microsoft lock-in”. So they appealed to the European Court of First Instance. And today that court announced its decision.

They upheld every detail of the EC’s earlier decision, except one minor point. The EC wanted there to be an independent trustee to watch over Microsoft’s future behaviour, to make sure the crooks didn’t fall back into their old habits. The court thought this would be too invasive. Lucky old Microsoft, eh!

But Microsoft have to stop “bundling” software like its media player with the Windows operating system. Microsoft must reveal its technological “secrets” to the other players in the European computing business (this is something that’s standard practice with other companies – they call it “standards”!)

And, ohh, this must be so galling to the miserly “robber barons” in charge of the Microsoft machine – Microsoft must pay a fine of 497 million euros! £343 million! US$690 million! And they even have to pay 80% of the EC’s legal costs! (The EC, in turn, must pay some proportion of Microsoft’s lawyers’ bill – though I’m sure it’s nothing like what the guilty ones must cough up). This massive cost won’t just anger the management – think how the shareholders must feel!!

Do you think Microsoft will learn their lesson from this punishment? Do you think the criminals will be cowed, repentant, rehabilitated? Hah! Even as they reel from the blows of the European Court, Microsoft are dreaming up other ways to impose the lock-in. Their competitors have decided to agree on a common, open format for files like text documents and spreadsheets. Everyone seems happy with a format called .odf (open document format). But Microsoft are trying to impose their own format – OOXML – and appear to be bribing or pressuring everyone they can get at to agree with them. And they’re threatening developers of Linux – the Free Software operating system – with legal action based on software patents that most knowledgeable people agree are phoney.

Now is the time for everyone who uses computers to stand up against the purveyors of lock-in and the threat of litigation. Microsoft’s latest OS – Vista – is widely judged to be amongst the most insecure, unstable and encumbered code they’ve ever released! And to run Vista, you need to buy powerful, expensive hardware! All of Microsoft’s long-suffering victims, whose dependence on legacy formats 20 years out of date has kept them locked-in to this arrogant corporation – now they must say “No more!” There are other software solutions – there’s UNIX – there’s Apple’s OSX, itself based on UNIX – and there’s Linux, the Free version of UNIX – all these operating systems are far more advanced and secure than anything Microsoft can hack together. And, because they all share that common UNIX ancestry, they can interoperate at all levels… something Windows could never do, even if its owners wanted it to.

Today’s decision of the European Court of First Instance has been a heavy blow to the bully of the software world. And it’s a wake-up call to everyone else.


%d bloggers like this: