Archive for March, 2013

Windows 8 x86 no network connection on VMware Workstation 9

On creating a Windows 8 virtual machine in VMware Workstation 9, the virtual machine will not be able to access the network.

If you go into device manager, the network adapter will be listed with no drivers installed.

To remedy this, edit the .vmx file, and add the following line:


ethernet0.virtualDev = "e1000e"

This solution is from VMware communities – Windows 8 RC internet connection.

,

Leave a comment

Random wonderings: IPv4 and NANP exhaustion

So this morning I was rudely awakened at about 3:30am, and my tired mind wandered and came up with a question I had to find an answer to.

Without going into a lot of technical background, IPv4 was invented in 1980. roughly 31 years later (2001) it’s 2^32 addresses (4,294,967,296 — some of which are reserved) were completely allocated and exhausted. The foreseeable exhaustion of these addresses led to the development of IPv6, which supports 2^64 addresses.

This got me thinking about the North American Numbering Plan (NANP) for telephone numbers, which had an address space of roughly 10^10 phone numbers (10,000,000,000 — some of which are reserved) which has been operating since 1947 (66 years!).

When would this number space be exhausted, and how would that event be handled?

Well, it turned out this is something carefully monitored by NANPA, the North American Numbering Plan Administration. They do not expect the current NANP number pool to exhaust until after 2042 (another 29 years, for a running total of 95 years in it’s current format!). While the potential changes haven’t been formalized yet, it appears that the most likely method will involve migrating to 4-digit area codes, as well as possibly inserting a prefix digit between the area code and prefix, for a total of 11 or 12 dialing digits (not including the country code).

So there you go.

Further reading:

, , ,

Leave a comment

Simple bash script to copy files via SCP

This can be used for example to retrieve a copy of one’s website, blog, or other files on a script or cron job. You will need to have your SSH identity files for passwordless login.

#!/bin/bash
#-- start config
# Local Directory for backups. A date-specific folder is created under this directory for the files.
LD=~/website_files/backups
# Remote Directory to retrieve. Files are retrieved recursively starting here. Hidden files are included.
# Must be full path, don't use ~ shortcut.
RD=/home/www
# Path to SSH ID file (private key)
ID=~/.ssh/id_rsa
# USERname to login as
USER=username
# HOST to login to
HOST=example.com
#--- end config

BD="$LD/`date +%F`"
mkdir $BD
scp -ri $ID $USER@$HOST:$RD/. $BD

Enjoy!

Leave a comment

Create SSH identity files for passwordless login

The SSH command-line program supports the use of identify files (via the -i parameter) to use certificate-based login. This is useful if you want to bypass the manual entry of passwords, or script an SSH or scp task.

Generating the identity files is relatively quick and easy.

First, lets assume there are two Linux systems, the local system (where the SSH connection originates), and the remote system (where the connection is being made to).

On the local system, run ssh-keygen

ssh-keygen

You can accept the default location of the keyfiles (~/.ssh), and press enter twice to generate the keyfiles with no password.

Now, in your destination directory you will have two files, id_rsa and id_rsa.pub. The file with the .pub extension is the public keyfile, while the other is the private one.

For security, chmod the .ssh directory to 0700.

chmod 0700 ~/.ssh

Transfer the public keyfile to your target system.

on your target system, create ~/.ssh directory with 0700 mode.

mkdir ~/.ssh
chmod 0700 ~/.ssh

rename the id_rsa file to authorized_keys and place it in ~/.ssh

You can now try to ssh into the target system by specifying the -i paremeter with the private keyfile.

Enjoy!

Further reading:

Leave a comment

Quick sh script cronjob to fix user homes permissions on Synology

If you have a Synology where multiple users access files, but frequently moves files around as the admin user, you’ve no doubt noticed that permissions can frequently get messed up, where regular users won’t be able to delete files created by the admin user, and so on. This can be especially prevalent when using the “user homes” feature.

(UPDATE: A reader has shared a new approach, please find it here: ACL fix for Synology DiskStations)

You could use file manager as the admin user to fix permissions by hand, but there’s an easier way.

This quick little script, when run as a cron task, will traverse the user home directories, resetting permissions automatically. It’s especially handy.This only acts on user home directories, and not any other shares.

This was done on a DS211j running DSM-4.2 BETA.

So, here’s the script:

HOMES="/volume1/homes"
cd $HOMES
for x in *; do chown -R $x $x; done

Change HOMES to reflect where your user home is.

So, first go in and upload it somewhere on your DiskStation where you like it. In this case, I’m uploading it to admin’s user home.

homeperms_1

Now, right-click on it and select Properties, and set it as follows (that’s chmod 0700 for those of you paying attention)

homeperms_2

Now, to simply set it as a scheduled task. Open Control Panel > Task Scheduler and click Create > User Defined Script.

homeperms_3

Set up the task as follows:

homeperms_4

Under the general tab, use something descriptive for the task name, and run as root. Make sure enabled is checked.

Enter the full path to your script (the provided is typical, but yours may differ — use SSH to help you locate the file if unsure)

For the schedule tab:

homeperms_5

I have mine set to run hourly. Granted, I don’t update my files that often, but it helps to make sure permissions are set correctly and make sure they’re never wrong for very long.

And then click Ok. This should show:

homeperms_6

And that’s it. Your home permissions will be fixed automatically from now on.

Questions, comments, or feedback on the above? Please leave it in the comment section below. Thank you!

Leave a comment