Linux Mint: OpenSSH Daemon

I’m in the process of reinstalling my work desktop. One of the mandatory packages which I install once the core system is up and running is a SSH Daemon.
Setting it up (on Linux Mint which I’m running) is pretty easy. To install the OpenSSH daemon go to the shell and write:

sudo apt-get install openssh-server

It’s a fairly small install, so in a few seconds it ought to be up and running. Next step is editing the default config file and change a few things.
Editing the config file is done by entering:

sudo vi /etc/ssh/sshd_config

The cofiguration options I usually edit these parameters:

PermitRootLogin no
#Banner /etc/
AllowUsers <username>
  • PermitRootLogin – The default option is yes, but frankly root should never be allowed to login remote unless absolutely needed.
  • Banner – Can allow a custom message be displayed at login (if needed).
  • AllowUsers – A space separated list of users allowed to login remotely.

Once the edits are done and saved, the openSSH Daemon needs to restarted which is done by:

sudo service ssh restart

Which packages are installed (on Ubuntu)

If you’re using a Debian based Linux Desktop such as Ubuntu, Linux Mint – or Debian itself naturally – you can easily create a simple text file of all packages installed on the machine.

I have a habit of removing a lot of the “extras” (junk) which comes with the basic install – not religiously, but just to keep it reasonably tidy and not have too much stuff eating up the harddisk, requiring updates (without providing any value).

Creating a list of the currently installed packages is quite simple – just open a terminal and enter:

dkpg --get-selections

(you will probably want to redirect the output into a file – or at least pipe it through more).

PHP 5.4 built-in webserver & Linux (mint/ubuntu)

PHP 5.4 comes with a built-in webserver, which can be useful for development and quick tests. It easily launched from the command-line, but if you’re running Linux Mint or Ubuntu, the PHP version, isn’t 5.4 but 5.3.x. If you don’t have the time/courage/energy to compile PHP 5.4 yourself, some nice fellow on the internet has done the work and made it available through a package repository which makes it a breeze to install.

To install PHP 5.4 on your Ubuntu or Linux Mint simply do this:

sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
sudo apt-get install php5

(answer yes to any questions asked).

then you should go to go. Verify the update with:

php --version

.. and the "answer" should be something like:

PHP 5.4.4-1~precise+1 (cli) (built: Jun 17 2012 13:01:09)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

(version numbers and dates are probably subject to change).

To use the webserver, go to the directory you want to be the document root, and launch the webserver with:

php -S localhost:8000

and you can also add a custom php.ini file with the configuration you want with:

php -c ./php.ini -S local:8000

Please remember, that the built-in webserver is only suited for development, but for a quick hack, it sure beats installing Apache or any other webserver.

Ubuntu: Changing your IP number

Sure it doesn’t happen that often, but sometimes you might need to change the IP number of your machine running Ubuntu. Either to configure it with a static IP number on your LAN or temporarily to configure a Wifi router – the latter being my case.

The first shot at changing the ip number, was going to the “System” menu, choosing Administration and Network Tools. It sounded just about right – but it’s wrong. Sure you view settings and some statistics, but it’s all read only.

ubuntu-network-connectionsSo, if you want to change the IP number, go to your top panel (in the right side, you’ll find you network icon. Right click on the icon and choose “Edit Connections”. In the window opening, you’ll have access to changing the ip number – to manual configuration, DHCP with ip number only or (as is default) full DHCP configuration.

Choosing “Automatic (DHCP) addresses only” allows you to get an automatic IP, but use openDNS’ DNS-servers – should you prefer them over the DNS servers provided by your ISP.

Ubunutu Uncomplicated Firewall

I’m still enjoying the fresh new Ubunutu 9.04, and one of the nice new features is a firewall – which Canonical calls “Uncomplicated Firewall”. I’m usually not hooked on firewalls, but just for the fun of it I enabled the firewall on my laptop and it seems to work quite well. The firewall doesn’t seem to have any noticeable impact on system performance and as the laptop from time to time visits open wifi’s, it’s probably a good idea to have protection from other users on open networks.

Installing the firewall

The firewall should be available by default, but there isn’t a GUI application installed for the firewall. Open your favorite package manager and install the “gufw” package.

sudo apt-get install gufw

Ouncomplicated_firewallnce installed the firewall can easily be turned on and of – and controlled from the System -> Administration -> Firewall configuration menu item.
I set the current configuration to “Deny incoming traffic” and enabled the firewall (beneat the shield). This is probably all most desktop users needs to do.
On my laptop, I am running a SSH server. I do this as a way to fetch files I may have forgotten on the machine when leaving the laptop at the office – or use it as a jumpstation to other machines.
Adding a rule in the firewall, which allows incoming SSH traffic was a simple matter of choosing the “preconfigured” tab, and there adding a rule allowing SSH traffic.

The firewall can be configured with much more advanced options, but if you really need that, you probably (or hopefully) know what to do, but for regular users having an easy to use firewall and an uncomplicated interface to manage it, is just great and one of the cool new features of Ubuntu 9.04.

Ctrix and Ubuntu 9.04

I’ve recently wiped the hard drive of my laptop and upgraded to Ubuntu 9.04. The Linux desktop is a perfect place to do development and surf the net, but the corporate network is a Windows world and to access mail and other enterprise applications we use Citrix servers. Getting Citrix running on the new Ubuntu is easier than ever.

sudo apt-get install libmotif3
sudo ln -s /usr/lib/ /usr/lib/

download the most recent client from Citrix.

mv linuxx86-11.0.140395.tar.gz  install_tmp
cd install_tmp
tar zxvf linuxx86-11.0.140395.tar.gz
sudo ./setupwfc

After finishing the install remove the “install_tmp” directory.

From here on it’s a matter of configuring the Citrix Receiver to your specific environment.
In my case, I gad a backup of the old Ubuntu installation, and I fetched the “.ICAClient” directory from my home-folder and putting in the same place on the new installation and no configuration was even needed.

(Thanks, Schack)

kUbuntu 7.10

kUbuntu logoJust a few days before leaving for South Africa, the latest version af Ubuntu was released. I really didn’t have the nerve to try and upgrade before my vacation, but today was the day.

Ubuntu is an operating system – like windows – but based upon (Debian) Linux. It can probably do everything you need – and it’s free. With the packaging done to Linux by the Ubuntu team(s), it’s a complete user-friendly and easy to use alternative for most computer users, and it has worked pretty well for me for the quite some time.

The upgrade

While it probably is possible to do a distribution upgrade, I’ve been reinstalling from scratch when upgrading. It usually just requires all the contents of my home-directory (and a few select configuration files from the /etc/ directory) to be zip’ed together in an archive. The archive is temporaryly store don a USB disk (about 600 Mb in total), while the harddisk was completely wiped and formatted.

The entire install process was the smoothest experience I’ve witnessed so far, and to less than 30 minutes. The packed homedir was unziped in a directory on the desktop, and the files and directories I know I needed was moved to the location they were placed in before the reinstall.

The software updater was run and within an hour the machine was running the new version. So far it’s been an impressive upgrade. Screen drivers, printers and just about everything work. Amazing.

Syntax checking PHP on the commandline

I’m sure most people only thing of PHP as a Weblanguage due to be called through a browser. It has however since version 4.3.0 also been possible to use PHP on the commandline – as you do with Perl, Shell scripts and likewise. If you’re using Linux (or an other Unix-like operating system – including Mac OSX) you probably have a few small programs available which can make it a breeze to check if the syntax in all you PHP scripts is correct.

Here’s how. On the commandline type:

find *.php |xargs -I {} php -l {}

… and here’s an explaination of what it does:

  • “find *.php” findes all files with a dot php ending.
  • the pipe-character “|” sends the result to a command called xargs.
  • “xargs -I {} php -l {}” takes the lines one by one password from the find and call “php -l <line input>”.
  • “php -l <line input>” (where line input would be the php-files found in bullit one) runs php with the “lint” parameter which does the syntax checking.

Switching browser in Ubuntu

In Kubuntu the default browser is Konquerer, but as a longtime Firefox user I wanted to use that as the system default browser. Googling around, I found a way to switch to the browser in Thunderbird, so that links in mails opened in Firefox, but it didn’t change in desktop links and other applications. Now another switcher found the solution.
Continue reading Switching browser in Ubuntu