Activate Windows from command line

Activating Windows from cmd usually takes two steps using slmgr.vbs tool:

Local Machine

Step 1: Change product key to valid one

slmgr /ipk XXX-YOUR-VALID-WIN-CODE-XXX

Step 2: Run online activation

slmgr /ato

If you prefer single-line command:

slmgr /ipk XXX-YOUR-VALID-WIN-CODE-XXX&&slmgr /ato

Process does take some time, so be patient.

Remote Machine

Same can be achieved on a remote machine, but success may vary depending on the permission/network settings:

slmgr 192.168.100.100 admin-user password /ipk XXX-YOUR-VALID-WIN-CODE-XXX
slmgr /ato

Your (usually volume licensed) PC should now be activated.

Increase swap file on Raspberry Pi

Changing swap size on your rPi is pretty straight forward. Raspbian uses a swap file solution dphys-swapfile, and is much easier to change the size of the swap than with standard partition based options.

Edit configuration file /etc/dphys-swapfile, default value on Raspbian is 100 MB of swap:

CONF_SWAPSIZE=100

Simply change the number to desired size in MB and restart dphys-swapfile:

/etc/init.d/dphys-swapfile stop
/etc/init.d/dphys-swapfile start

Of course, don’t forget swap file is physically located on your SD card (usually /var/swap) so it also takes the space there.

That’s it, enjoy your increased size of your swap!

Vsftpd with SSL/TLS support on Ubuntu

Configure vsftpd to use SSL/TLS on Ubuntu VPS, dedi or physical machine. This how-to assumes vsftpd is already configured and running without encryption support.

Generate SSL certificate

Let’s create some SSL certificates to use with vsftpd. Change -nodes-days to desired number of days, example bellow assumes  one year (365 days).

openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem

Edit /etc/vsftpd.conf

Add the following lines to vsftpd config file:

# Uncomment or add the path to cert
# we generated in previous step
rsa_cert_file=/etc/ssl/private/vsftpd.pem

# Enable SSL support
ssl_enable=YES

# Force local users to use SSL
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES

# allow only TLS, not SSL
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO

# Some additional security and compatibility settings
# Filezilla reports GnuTLS error without strong ciphers
require_ssl_reuse=NO
ssl_ciphers=HIGH

# Optional: enable passive connection if not already configured
# (add appropriate rules to your firewall - iptables/UFW etc.)
pasv_enable=YES
pasv_min_port=63000
pasv_max_port=63100

Restart service

sudo service vsftpd restart

Connect with client

Now connect with your favourite client (like Filezilla), don’t forget to set Require explicit FTP over TLS. Port stays default 21, if you didn’t specify otherwise in the config file of course.

 

Fix SSL sec_error_unknown_issuer with Comodo PositiveSSL in Firefox (Apache2)

Installing Comodo PositiveSSL certificate on Apache server for a client, everything worked fine in Chrome, Firefox on OS X and (surprisingly) even in IE, but Firefox on Windows was complaining with the following error (might be something to do with older version or some other settings, but didn’t really test it that extensively):

Invalid security certificate.
The certificate is not trusted because no issuer chain was provided.
(Error code: sec_error_unknown_issuer)

After a bit of googling I came across a blog post by John Bakker, where he describes a quick and easy fix, merging all .crt files you receive from Comodo into one .ca_bundle.

To do this, the easiest way is to combine (concatenate) multiple certificates into one file, named www_yourdomain_com.ca_bundle (of course replace www_yourdomain_com with your actual domain with underscores):

  1. AddTrustExternalCARoot.crt
  2. COMODORSAAddTrustCA.crt
  3. COMODORSADomainValidationSecureServerCA.crt
  4. www_yourdomain_com.crt
cat www_yourdomain_com.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > www_yourdomain_com.ca_bundle

Note: Device/Entity Cert Intermediates need to be in reversed order.

Place it in the same place you put your .key and .crt and .csr files for your certificate.
Now instead of pointing it to the individual files you point to just the bundle from your vhost.

SSLEngine on
SSLCertificateFile /etc/ssl/certs/www_yourdomain_com.crt
SSLCertificateKeyFile /etc/ssl/certs/www_yourdomain_com.key
SSLCertificateChainFile /etc/ssl/certs/www_yourdomain_com.ca-bundle

Restart apache and enjoy secure connection to your site without SSL errors in all browsers.

Remove Ubuntu sysinfo on user login

Do you also hate the (not so) slight delay for the system information to appear when you login to your Ubuntu Server console? Here are a couple of ways how to change the displayed information or even get completely rid of it.

Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.2.0-29-generic x86_64)
  * Documentation: https://help.ubuntu.com/

System information as of Thu Jul 31 12:12:12 CEST 2014

System load: 0.08               Processes: 86
Usage of /: 11.9% of 155.51GB   Users logged in: 0
Memory usage: 72%               IP address for eth0: 74.125.12.12
Swap usage: 0%

Graph this data and manage this system at:
  https://landscape.canonical.com/

Disable with reconfigure

To hide system information you can either remove the landscape-common package or just run dpkg-reconfigure again and choose to not display the landscape-sysinfo on login.

dpkg-reconfigure landscape-common

Remove the package

apt-get remove --purge landscape-common

Choose what to display

Alternatively, you can choose to display just certain parts on sysinfo.

Edit /etc/landscape/client.conf, and add them comma separated:

[sysinfo]
exclude_sysinfo_plugins = LandscapeLink,Temperature,Processes

You can remove any of these plugins (information):

Load, Disk, Memory, Temperature, Processes, LoggedInUsers, LandscapeLink, Network

Or just test it on the command line:

landscape-sysinfo  --exclude-sysinfo-plugins=Temperature,LandscapeLink,Processes
Link

Best house music out there

House music is a genre of electronic dance music that originated in the American city of Chicago in the early 1980s.

Early house music was generally dance-based music characterized by repetitive 4/4 beats. While house displayed several characteristics similar to disco music, it was more electronic and minimalistic, and the repetitive rhythm of house was more important than the song itself.

House music today, while keeping several of these core elements, varies a lot in style and influence, ranging from the soulful and atmospheric deep house to the more minimalistic minimal house. House music has also fused with several other genres creating fusion subgenres, such as euro house, tech house, and electro house.

The best of all this can be found 24/7 on the craziest house radio out there, bAm BaM Radio (http://www.bambamradio.com)