Category: Ubuntu


AWS SSH Fingerprint

By polfilm,

IF SHORT

root@ubuntu:~/.ssh/mac$ openssl pkey -in id_rsa -pubout -outform DER | openssl md5 -c
(stdin)= 6a:96:26:bd:fd:41:4f:53:77:67:78:13:01:c9:9c:12

IF LONG

openssl pkcs8 -in aws_private.pem -nocrypt -topk8 -outform DER | openssl sha1 -c

File Duplicates Recursive in Linux

By polfilm,
md5deep -r -l . > filelist.txt
sort < filelist.txt > filelist_sorted.txt

First command will render all hashes for all files
Second will sort the list so as you scroll you will easily spot duplicates with their paths.
m5deep is in most apt-get and yum repos.

Lighttpd rewrite rules for WordPress sites

By polfilm,
  # Handle 404 errors
  server.error-handler-404 = "/index.php"
 
  # Rewrite rules
  url.rewrite-final = (
 
    # Exclude some directories from rewriting
    "^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)" => "$0",
 
    # Exclude .php files at root from rewriting
    "^/(.*.php)" => "$0",
 
    # Handle permalinks and RSS feeds
    "^/(.*)$" => "/index.php/$1"
  )

Ubuntu New User

By polfilm,
sudo useradd -d /home/<username> -s /bin/bash -m <username>
sudo passwd <username>
sudo adduser <username> sudo

Jenkins-Tomcat manual upgrade script

By polfilm,
#!/bin/bash
 echo "stopping tomcat"
 sh /etc/init.d/tomcat6 stop
 cd /var/lib/tomcat6/webapps
 echo "removing jenkins"
 rm -rf jenkins
 rm -rf jenkins.war
 echo "downloading latest jenkins"
 wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war
 echo "starting tomcat"
 sh /etc/init.d/tomcat6 start
 cd ~
 echo "done"

Credit: http://www.christianoestreich.com/2011/03/jenkins-upgrade-script/
In ubuntu old jenkins.war is in /usr/share/jenkins/ folder
In ubuntu use “service tomcat6 stop” to stop the service

OpenVPN Ubuntu 12.04 Autostart

By polfilm,
sudo update-rc.d openvpn enable 2345

/etc/openvpn/ (config files go here)
	>> change config extension client.ovpn to client.conf
	>> change group=nobody to group=nogroup
	
/etc/default/openvpn (file)
	>> AUTOSTART=all