Category Archives: Unix Stuff

Do you want to use RDP on a Windows client to reach a Linux server?

Install and configure EPEL repository

Add nux repository

Install xrdp

Use YUM command to install xrdp.

If you forgot your root password for your Debian server use the following procedure to reset. This has been tested on ‘Wheezy’

Press SHIFT on boot to get into the GRUB menu. Select the option to edit the commands (c?). Move the cursor down until you see the line starting ‘linux’ and append the text to below to that line. Press CTRL+x to boot the system.

You will shortly get the command line. At this point, the root file system is still mounted read-only, so enter the following to remount it READ WRITE –

Then type –

Enter your new password. Retype if asked to confirm.
Then restart the machine by typing –

Now you should be able to login with your new root password as required.

FreeNAS VM – EFI Booting

Recently I updated my FreeNAS installation to the latest version. This now supports VMs. I installed a Centos VM to run a CrashPlan backup service. However, I noticed that the VM always went back to the EFI boot menus when it rebooted – not much use…

I found the following solution –

Using the original install CD I used the ‘Rescue’ option to boot my installed version. I then used chroot /mnt/sysimage to get to the installed files.

You then need to make some changes to the EFI boot file locations

After this everything should boot fine – however, make sure you update the CDROM device to remove the .iso file – if not, the VM will constantly boot into the setup CD! If you have issues with deleting the entry to the .iso image, just create a zero length file, call it ’empty.iso’ and point the device to that.

Raspbian Jessie Lite – Enable ssh when headless

The Raspbian Jessie Lite image is shipped as default with ssh disabled. This is a bit of a pain if you plan to use your Raspberry Pi headless straight out of the box.

Fortunately it is easy to get round this and enable ssh on the SD Card as you create the image.

Just create an empty file called ssh and copy it to the boot partition of the flash card.

To create an empty file in windows, use the following from the command prompt

Python & SNMP

There is an excellent SNMP Simulator available – http://snmpsim.sourceforge.net/

Install the required libraries before trying to use –

tenscripting3 and a HomeTroller Zee

I’ve just started working with a HomeSeer HomeTroller Zee device, something I am looking at using to help monitor the temperature in my house and control the heating, provided by a number of FIR (Far Infra Red) panels – Something recently purchased from Future Energy Solutions

In order to help develop some custom scripts on my HomeTroller Zee I started looking around and came across tenScripting3. This uses various plugins and addons for Microsoft Visual Studio to help write and debug your scripts.

The plugins can talk directly to your HomeSeer installation in order to update scripts and also monitor activity in real time, however, in order to do this it requires a Windows File Share, or in the case of Linux, a SMB share…

The HomeTroller Zee doesn’t come with Samba enabled by default and I was a little hesitant about messing about with the build of linux that is supplied pre-installed.

However, all is not lost. By using an intermediate system (Centos), it is possible to create a SMB share that is visible to your Windows Machine running Visual Studio and also share out the HomeSeer folder from your HomeTroller Zee…

We end up with something like this –

Visual Studio and the tenScripting3 apps think they are talking to the HomeTroller using a Windows File Share, however, they are talking to the CentOS server, which in turn is talking to the HomeTroller. The best part is that you don’t need to make any changes to the HomeTroller as that part of the connection uses SSH, which is already in place!

In order to get this working I did the following.

CentOS Server

Built a standard CentOS machine running as a virtual server – using VirtualBox on the desktop running Visual Studio,

Install samba

Configure Samba

/etc/samba/smb.conf

Edit the sshfs configuration file to allow Samba to share it out /etc/fuse.conf

Create the folder where you are going to mount HomeTroller

Finally, mount the HomeTroller remote filesystem

If all has gone well you should now be able to browse from your windows PC and see the HomeTroller files & folders.

What time is now?

Configuring the time on a Centos box –

First we make sure we have a backup of the current timezone configuration, then we set it to the required timezone.

Then we install the ntp daemon if not already installed. We then switch it on, get the current time and start the daemon.

rsync – Quick Reference

rsync is great to keep two folders or machines in sync, either locally or remotely. However, there are loads of command line options that can look complex for the initial user.

I have used the following command to sync one folder to another –

Notice that when you specify the source you must have a trailing ‘/’ to indicate the source directory. The destination is then specified by the directory you want to sync the files into.

By default rsync will not delete any files in the destination that it does not find in the source.

In the example above –

a – archive, this will sync folders recursively and deals with symbolic links and other special files. It also preserves dates, times, owners etc.
n – dry run – just show on the screen what will be done. Nothing is actually moved, created/deleted.
v – verbose, additional output onscreen.
P – Progress & Partial, shows progress of transfers and also allows restart after partial sync.

You may have noticed in the above example that both folders are in /mnt/…… I am using a Centos server to sync some folders from a HDA NAS system back to a Windows Home Server. Both systems are presenting shared drives that the Centos server has mounted and is then scanning in order to complete the rsync. The windows files shares are mounted using mount.

When entering the above commands you will be prompted for the password of the user supplied in order to access the fileshare.