<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8222363368992442646</id><updated>2026-06-01T20:41:07.853+01:00</updated><category term="Linux"/><category term="Command Line"/><category term="Databases"/><category term="Scripting"/><category term="Networking"/><category term="Ubuntu"/><category term="Virtualization"/><category term="xenserver"/><category term="MySQL"/><category term="Backups"/><category term="Monitoring"/><category term="Oracle"/><category term="Cisco"/><category term="Apache"/><category term="DMS"/><category term="Zabbix"/><category term="Alfresco"/><category term="Mac OS X"/><category term="citrix"/><category term="storage"/><category term="webserver"/><category term="PostgreSQL"/><category term="Windows"/><category term="bash"/><category term="email"/><category term="vmware"/><category term="LDAP"/><category term="Time Machine"/><category term="backuppc"/><category term="gammu"/><category term="gsm modem"/><category term="OpenVPN"/><category term="Postfix"/><category term="SVN"/><category term="Tomcat"/><category term="iptables"/><category term="knowledge managment"/><category term="mailscanner"/><category term="sms gateway"/><category term="Boot"/><category term="CloudStack"/><category term="Cluster"/><category term="Debian"/><category term="Debugging"/><category term="LVM"/><category term="baruwa"/><category term="dovecot"/><category term="iscsi"/><category term="openkm"/><category term="proxy"/><category term="security"/><category term="vi"/><category term="Android"/><category term="CentOS"/><category term="DNS"/><category term="DRBD"/><category term="Docker"/><category term="Git"/><category term="GitLab"/><category term="HA"/><category term="Hardware"/><category term="IMAP"/><category term="Macbook"/><category term="PHP"/><category term="PostGrey"/><category term="PowerShell"/><category term="RHEL"/><category term="SQLite"/><category term="Samba"/><category term="Squid"/><category term="Unix"/><category term="VPN"/><category term="alert"/><category term="auth"/><category term="certificates"/><category term="evernote"/><category term="everpad"/><category term="firehole"/><category term="firewall"/><category term="ftp"/><category term="glusterfs"/><category term="grub"/><category term="https"/><category term="imagemagick"/><category term="keystore"/><category term="locale"/><category term="netcat"/><category term="nginx"/><category term="python"/><category term="services"/><category term="spamassassin"/><category term="ssl"/><category term="telnet"/><category term="testing"/><category term="tftp"/><category term="wifi"/><title type='text'>Sysadmin Notebook</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>182</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-6302123928446487658</id><published>2015-08-03T16:36:00.005+01:00</published><updated>2016-09-22T13:33:15.648+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Docker"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>DOCKER_OPTS in /etc/default/docker ignored on Ubuntu</title><content type='html'>For some reason, in debian 8 and ubuntu 15.01 systemd is skipping the execution of /etc/default/docker.&lt;br /&gt;
&lt;br /&gt;
How to fix?&lt;br /&gt;
&lt;br /&gt;
Copy the original systemd service file to /etc/systemd/system/&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo cp &amp;nbsp;/lib/systemd/system/docker.service /etc/systemd/system/&lt;/blockquote&gt;
&lt;br /&gt;
Edit file /etc/systemd/system/docker.service&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
...&lt;br /&gt;
[Service]&lt;br /&gt;
ExecStart=/usr/bin/docker -d -H fd:// $DOCKER_OPTS&lt;br /&gt;
...&lt;br /&gt;
EnvironmentFile=-/etc/default/docker&lt;br /&gt;
...&lt;/blockquote&gt;
Then execute:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo systemctl daemon-reload&lt;br /&gt;
sudo systemctl restart docker&lt;/blockquote&gt;
Verify that /etc/default/docker is loaded&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
ps auxwww | grep docker&lt;br /&gt;
root &amp;nbsp; &amp;nbsp; &amp;nbsp;4989 &amp;nbsp;0.8 &amp;nbsp;0.1 265540 16608 ? &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Ssl &amp;nbsp;10:37 &amp;nbsp; 0:00 /usr/bin/docker -d -H fd:// --insecure-registry&amp;nbsp;&lt;/blockquote&gt;
&lt;br /&gt;
That&#39;s it.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/6302123928446487658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2015/08/dockeropts-in-etcdefaultdocker-ignored.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/6302123928446487658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/6302123928446487658'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2015/08/dockeropts-in-etcdefaultdocker-ignored.html' title='DOCKER_OPTS in /etc/default/docker ignored on Ubuntu'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-5473828650921273937</id><published>2015-07-27T21:56:00.002+01:00</published><updated>2015-07-27T21:57:28.902+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="Networking"/><title type='text'>Enable Layer3 on a Cisco Switch</title><content type='html'>This is what worked for me on a Cisco WS-C2960-24PS-L switch:&lt;br /&gt;
&lt;br /&gt;
First you need to change the sdm prefer from dafult to lanbase-routing.&lt;br /&gt;
The lanbase-routing template supports IPv4 unicast routes for configuring static routing SVIs.&lt;br /&gt;
Static routing is supported only on switched virtual interfaces (SVIs) and not on physical interfaces. The switch does not support routing protocols.&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
conf t&lt;br /&gt;
sdm prefer lanbase-routing&lt;br /&gt;
end&lt;br /&gt;
wr&lt;br /&gt;
reload&amp;nbsp;&lt;/blockquote&gt;
&lt;br /&gt;
Then you have to enable ip routing:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
conf t&lt;br /&gt;
ip routing&lt;/blockquote&gt;
Then you can add the static routes you like.</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/5473828650921273937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2015/07/enable-layer3-on-cisco-switch.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/5473828650921273937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/5473828650921273937'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2015/07/enable-layer3-on-cisco-switch.html' title='Enable Layer3 on a Cisco Switch'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-7540313316489913723</id><published>2015-02-16T18:09:00.000+00:00</published><updated>2015-02-16T18:10:51.092+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Cisco"/><category scheme="http://www.blogger.com/atom/ns#" term="Debugging"/><category scheme="http://www.blogger.com/atom/ns#" term="Monitoring"/><category scheme="http://www.blogger.com/atom/ns#" term="Networking"/><title type='text'>Configure CISCO Catalyst 2960 ports to monitoring/mirroring mode</title><content type='html'>This will send all traffic that comes on the 0/1-0/9 ports to the Ga0/1 interface: &lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
switch&amp;gt;enable&lt;br /&gt;
switch#configure terminal&lt;br /&gt;
Enter configuration commands, one per line.&amp;nbsp; End with CNTL/Z.&lt;br /&gt;
&lt;br /&gt;
switch(config)#monitor session 1 source interface fastEthernet 0/1&lt;br /&gt;
switch(config)#monitor session 1 source interface fastEthernet 0/2&lt;br /&gt;
switch(config)#monitor session 1 source interface fastEthernet 0/3&lt;br /&gt;
switch(config)#monitor session 1 source interface fastEthernet 0/4&lt;br /&gt;
switch(config)#monitor session 1 source interface fastEthernet 0/5&lt;br /&gt;
switch(config)#monitor session 1 source interface fastEthernet 0/6&lt;br /&gt;
switch(config)#monitor session 1 source interface fastEthernet 0/7&lt;br /&gt;
switch(config)#monitor session 1 source interface fastEthernet 0/8&lt;br /&gt;
&lt;br /&gt;
switch(config)#monitor session 1 destination interface gigabitEthernet 0/1&lt;/blockquote&gt;
Show info:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
switch#show monitor session 1&lt;br /&gt;
Session 1&lt;br /&gt;
---------&lt;br /&gt;
Type&amp;nbsp;&amp;nbsp;&amp;nbsp; : Local Session&lt;br /&gt;
Source Ports : &lt;br /&gt;
&amp;nbsp;Both: Fa0/1-8&lt;br /&gt;
Destination Ports : Gi0/1&lt;br /&gt;
&amp;nbsp;Encapsulation : Native&lt;br /&gt;
&amp;nbsp; Ingress : Disabled&lt;/blockquote&gt;
And now we can capture this traffic: &lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
# tcpdump -i eth0 -n &lt;/blockquote&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/7540313316489913723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2015/02/configure-cisco-catalyst-2960-ports-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/7540313316489913723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/7540313316489913723'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2015/02/configure-cisco-catalyst-2960-ports-to.html' title='Configure CISCO Catalyst 2960 ports to monitoring/mirroring mode'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-6574559071928380111</id><published>2015-02-09T20:56:00.000+00:00</published><updated>2015-02-09T20:56:29.698+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="netcat"/><category scheme="http://www.blogger.com/atom/ns#" term="Scripting"/><category scheme="http://www.blogger.com/atom/ns#" term="webserver"/><title type='text'>One line web server</title><content type='html'>The following one line script will create a web server running on port 80 using nc (netcat):&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
while true; do { echo -e &#39;HTTP/1.1 200 OK\r\n&#39;; cat index.html; } | nc -l 8080; done&lt;/blockquote&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/6574559071928380111/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2015/02/one-line-web-server.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/6574559071928380111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/6574559071928380111'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2015/02/one-line-web-server.html' title='One line web server'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-935286910430375008</id><published>2014-09-07T15:46:00.000+01:00</published><updated>2014-10-13T21:03:48.902+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bash"/><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="Debian"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Scripting"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Purge Removed packages</title><content type='html'>Packages marked as rc by dpkg mean that the configuration files are not yet removed. The following command will purge them:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
dpkg --list |grep &quot;^rc&quot; | cut -d &quot; &quot; -f 3 | xargs -r sudo dpkg --purge&lt;/blockquote&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/935286910430375008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/09/purge-removed-packages.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/935286910430375008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/935286910430375008'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/09/purge-removed-packages.html' title='Purge Removed packages'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-5751501892829813952</id><published>2014-09-07T15:44:00.001+01:00</published><updated>2014-10-13T21:05:32.634+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bash"/><category scheme="http://www.blogger.com/atom/ns#" term="Scripting"/><title type='text'>How to permanently delete ALL older kernels</title><content type='html'>&lt;div&gt;
This script will remove ALL versions but two, the currently active and the most recent of the remaining installed versions:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
#/bin/bash&lt;br /&gt;
keep=2&lt;br /&gt;
ls /boot/ | grep vmlinuz | sed &#39;s@vmlinuz-@linux-image-@g&#39; | grep -v $(uname -r) | sort -Vr | tail -n +$keep | while read I&lt;br /&gt;
do&lt;br /&gt;
&amp;nbsp; &amp;nbsp; aptitude purge -y $I&lt;br /&gt;
done&lt;br /&gt;
update-grub&lt;/blockquote&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
you can specify how many kernels to keep by adjusting the keep variable, if you set it to 1, only the active kernel will be left installed.&lt;br /&gt;
&lt;br /&gt;
Or you can do it in one line:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
ls /boot/ | grep vmlinuz | sed &#39;s@vmlinuz-@linux-image-@g&#39; | grep -v $(uname -r) | sort -Vr | tail -n +2 | xargs -r sudo aptitude purge -y&lt;/blockquote&gt;
that you can use in crontab.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/5751501892829813952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/09/how-to-permanently-delete-all-older.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/5751501892829813952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/5751501892829813952'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/09/how-to-permanently-delete-all-older.html' title='How to permanently delete ALL older kernels'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-3873057845758971287</id><published>2014-08-30T16:10:00.000+01:00</published><updated>2014-09-23T12:57:13.882+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CentOS"/><category scheme="http://www.blogger.com/atom/ns#" term="Debian"/><category scheme="http://www.blogger.com/atom/ns#" term="Git"/><category scheme="http://www.blogger.com/atom/ns#" term="GitLab"/><category scheme="http://www.blogger.com/atom/ns#" term="Scripting"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>GitLab update script</title><content type='html'>I&#39;ve recently installed GitLab and they provide easy to install deb and rpm packages but not a repository to help us keep our installation up to date. So I developed the following script that will check&amp;nbsp;https://about.gitlab.com/downloads/archives/ for newer versions and install them when available:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
#!/bin/bash&lt;br /&gt;
OS=&quot;ubuntu&quot;&lt;br /&gt;
OS_Version=&quot;14.04&quot;&lt;br /&gt;
OS_ARCHITECTURE=&quot;amd64&quot;&lt;br /&gt;
# Ubuntu/Debian:&lt;br /&gt;
INSTALLED_VERSION=$(dpkg -s gitlab | grep -i version | cut -d&quot; &quot; -f2)&lt;br /&gt;
# CentOS:&lt;br /&gt;
#INSTALLED_VERSION=$(rpm -qa | grep omnibus)&lt;br /&gt;
# Uses sort -V to compare versions&lt;br /&gt;
LATEST=$(wget -q -O- https://about.gitlab.com/downloads/archives/ | grep -i &quot;$OS&quot; | grep -i &quot;$OS_VERSION&quot; | grep -i $OS_ARCHITECTURE | grep -Eo &#39;href=&quot;.*&quot;&#39; | cut -d&#39;&quot;&#39; -f2 | sort -V | tail -n 1)&lt;br /&gt;
PACKAGE=${LATEST##*/}&lt;br /&gt;
LATEST_VERSION=$(echo $PACKAGE | cut -d_ -f2)&lt;br /&gt;
echo &quot;&quot;&lt;br /&gt;
echo &quot; Current version: $INSTALLED_VERSION&quot;&lt;br /&gt;
echo &quot; Latest version: $LATEST_VERSION&quot;&lt;br /&gt;
if [[ &quot;$INSTALLED_VERSION&quot; != &quot;$LATEST_VERSION&quot; &amp;amp;&amp;amp; &quot;$LATEST_VERSION&quot; != &quot;&quot; ]]; then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; echo &quot; &amp;nbsp; &amp;nbsp;Update to $LATEST_VERSION available!&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; echo -n &quot; &amp;nbsp; &amp;nbsp; Do you wich to upgrade? [y/N]? &quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; read answer&lt;br /&gt;
&amp;nbsp; &amp;nbsp; case $answer in&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; y*)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Backup branding:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cp /opt/gitlab/embedded/service/gitlab-rails/public/assets/*logo*.png /tmp/&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wget $LATEST&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Stop unicorn and sidekiq so we can do database migrations&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sudo gitlab-ctl stop unicorn&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sudo gitlab-ctl stop sidekiq&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Create a database backup in case the upgrade fails&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sudo gitlab-rake gitlab:backup:create&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Install the latest package&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Ubuntu/Debian:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sudo dpkg -i $PACKAGE&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # CentOS:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #sudo rpm -Uvh $PACKAGE&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Restore branding:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sudo cp /tmp/*logo*.png /opt/gitlab/embedded/service/gitlab-rails/public/assets/&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Reconfigure GitLab (includes database migrations)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sudo gitlab-ctl reconfigure&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Restart all gitlab services&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sudo gitlab-ctl restart&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rm $PACKAGE&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo &quot;No change&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; esac&lt;br /&gt;
else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; echo &quot; &amp;nbsp; &amp;nbsp;Nothing to do!&quot;&lt;br /&gt;
fi&lt;br /&gt;
echo &quot;&quot;&lt;/blockquote&gt;
I haven&#39;t tested this script on a CentOS machine so it might need some adjustments to work there.</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/3873057845758971287/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/08/gitlab-update-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/3873057845758971287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/3873057845758971287'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/08/gitlab-update-script.html' title='GitLab update script'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-219951559599931743</id><published>2014-07-25T14:25:00.001+01:00</published><updated>2014-07-25T14:25:10.029+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="backuppc"/><category scheme="http://www.blogger.com/atom/ns#" term="Backups"/><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><title type='text'>Removing hosts from backuppc</title><content type='html'>Simply remove the host from the web interface and rm -rf the pc/&amp;lt;host&amp;gt; directory, then wait for the next BackupPC_nightly run - it will remove all superfluous files from the pools.&lt;br /&gt;
&lt;br /&gt;
The path for this directory usually is:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
/var/lib/Backuppc/pc/&amp;lt;hostname&amp;gt;&lt;/blockquote&gt;
If you want to force the clean-up process, you can remove your host like this:&lt;br /&gt;
&lt;br /&gt;
1. Login to the Backuppc server&lt;br /&gt;
2. Remove the host in the Backuppc web-interface (under hosts)&lt;br /&gt;
3. remove it&#39;s directory /var/lib/Backuppc/pc/&amp;lt;hostname&amp;gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
rm -rf /var/lib/Backuppc/pc/&amp;lt;hostname&amp;gt;&lt;/blockquote&gt;
4. Shutdown backuppc:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
service backuppc stop&lt;/blockquote&gt;
5. Change into backuppc:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
su - backuppc&lt;/blockquote&gt;
6. Run the nightly script:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
/usr/share/BackupPC/bin/BackupPC_nightly 0 255&lt;/blockquote&gt;
7. Go back to root:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
exit&lt;/blockquote&gt;
8. Start backuppc again:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
service backuppc start&lt;/blockquote&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/219951559599931743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/removing-hosts-from-backuppc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/219951559599931743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/219951559599931743'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/removing-hosts-from-backuppc.html' title='Removing hosts from backuppc'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-85582961104275649</id><published>2014-07-25T11:36:00.000+01:00</published><updated>2014-07-25T11:36:27.713+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Backups"/><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="Mac OS X"/><category scheme="http://www.blogger.com/atom/ns#" term="Time Machine"/><title type='text'>Reclaim free space from Time Machine sparsebundle</title><content type='html'>You msut run these commands as root:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo su -&amp;nbsp;&lt;/blockquote&gt;
Make sure the mount point exists:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
mkdir -p /Volumes/TM&lt;/blockquote&gt;
Then mount the afp share:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
mount_afp &#39;afp://user:password@afp_server_address/share_name&#39; /Volumes/TM&lt;/blockquote&gt;
Now use hdiutil to reclaim the available free space:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
hdiutil compact /Volumes/TM/ComputerName.sparsebundle/&lt;/blockquote&gt;
unmont the share:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
umount /Volumes/TM/&lt;/blockquote&gt;
If you get an error message saying:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
hdiutil: compact failed - Resource temporarily unavailable&lt;/blockquote&gt;
You must make sure you don&#39;t have the afp share mounted elsewhere, you can check your mounts with:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
df -h&lt;/blockquote&gt;
If the output contains a line with your afp server&#39;s address or with the string &quot;Time Machine&quot; you have to unmount them.&lt;br /&gt;
&lt;br /&gt;
The following script will do all that for you:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
SRV=&quot;afp_server_address&quot;&lt;br /&gt;SAVEIFS=$IFS&lt;br /&gt;IFS=$&#39;\n&#39;;&lt;br /&gt;for v in $(df -h | grep -E &quot;$SRV|Time\sMachine&quot; &amp;nbsp;| cut -d&quot;%&quot; -f3 | &amp;nbsp;sed -e &quot;s/ *\//\//&quot;); do&lt;br /&gt;&amp;nbsp; &amp;nbsp; umount &quot;$v&quot;&lt;br /&gt;done&lt;br /&gt;IFS=$SAVEIFS&lt;br /&gt;mkdir -p /Volumes/TM&lt;br /&gt;mount_afp &quot;afp://user:password@$SRV/share&quot; /Volumes/TM&lt;br /&gt;hdiutil compact &quot;/Volumes/TM/$(scutil --get ComputerName).sparsebundle&quot;&lt;br /&gt;umount /Volumes/TM/&lt;/blockquote&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/85582961104275649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/reclaim-free-space-from-time-machine.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/85582961104275649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/85582961104275649'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/reclaim-free-space-from-time-machine.html' title='Reclaim free space from Time Machine sparsebundle'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-5445829973179652418</id><published>2014-07-24T22:02:00.000+01:00</published><updated>2014-07-30T10:15:45.193+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Backups"/><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="Mac OS X"/><category scheme="http://www.blogger.com/atom/ns#" term="Time Machine"/><title type='text'>Changing Time Machine Backup Interval</title><content type='html'>You can use the following command to change the Time Machine backup interval:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo defaults write /System/Library/LaunchDaemons/com.apple.backupd-auto StartInterval -int 14400&lt;/blockquote&gt;
The time interval is in seconds, so 43200 will start a backup every 12hrs.&lt;br /&gt;
&lt;br /&gt;
Checkout my &lt;a href=&quot;http://sysadminnotebook.blogspot.pt/2014/07/manage-time-machine-backups.html&quot;&gt;previous post&lt;/a&gt; to learn how to manually delete Time Machine backups.</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/5445829973179652418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/changing-time-machine-backup-interval.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/5445829973179652418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/5445829973179652418'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/changing-time-machine-backup-interval.html' title='Changing Time Machine Backup Interval'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-638554985537654402</id><published>2014-07-24T19:08:00.001+01:00</published><updated>2014-07-24T19:18:42.716+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Backups"/><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="Mac OS X"/><category scheme="http://www.blogger.com/atom/ns#" term="Time Machine"/><title type='text'>Manage time machine backups</title><content type='html'>&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
Some times you get some errors saying that your time machine&#39;s disk is full and&amp;nbsp;Time Machine could not complete the backup so you need to&amp;nbsp;&amp;nbsp;manually delete old backups.&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;b&gt;tmutil&lt;/b&gt; provides methods of controlling and interacting with Time Machine, as well as examining and manipulating Time Machine backups. Common abilities include restoring data from backups, editing exclusions, and comparing backups.&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
tmutil latestbackup&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
Will output the path to the most recent backup and&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
tmutil listbackups&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
will list all existing backups, if you use the same backup disk for multiple machines, you can get just the backups from your machine with:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
tmutil listbackups | grep &quot;$(scutil --get ComputerName)&quot;&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
The following command will delete the backups from a mac named old_mac_name:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
sudo tmutil delete /Volumes/drive_name/Backups.backupdb/old_mac_name&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
If you want to be safe, you can pick one snapshot to delete first to be sure the command works as intended. This is nice since it could take hours to clean up some larger backup sets and you want to leave the Mac confident it&#39;s deleting the correct information store.&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
You can use the tmutil tool to delete backups one by one.&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
sudo tmutil delete /Volumes/drive_name/Backups.backupdb/mac_name/YYYY-MM-DD-hhmmss&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;div&gt;
Since tmutil was introduced with Lion, this will not work on earlier OS versions.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The tmutil delete command only removes the backup from the sparse bundle. It doesn’t actually free the disk space. To do that, you have to go a little deeper.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
On your Mac is a mount point called /Volumes. You can examine the contents of this mount point with ls:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
cd /Volumes&lt;br /&gt;
ls -1&lt;/blockquote&gt;
Should output something like:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Macintosh HD&lt;br /&gt;
Recovery HD&lt;br /&gt;
Time Machine Backups&lt;br /&gt;
TimeMachine&lt;/blockquote&gt;
&lt;div&gt;
These are the names of all the mounted disks (or things that look like disks) on your Mac. Notice two likely candidates for your actual TimeMachine volume. Yours may be named slightly differently, but the one you want is the one that actually shows files of type .sparsebundle . In my case, it is the volume TimeMachine:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo ls -l TimeMachine/&lt;/blockquote&gt;
&lt;div&gt;
and you should see something similar to:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
...&lt;br /&gt;
drwxr-x---@ 1 root wheel 264 Jul 25 08:21 sysadmin’s MacbookPro.sparsebundle&lt;br /&gt;
...&lt;/blockquote&gt;
&lt;div&gt;
Notice that you don’t actually own the file. (Had I not used the sudo command with ls I could not have listed the contents of /Volumes/TimeMachine)&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
That .sparsebundle file for your Mac is where all your backup sets live. TimeMachine manages the contents of this file, but doesn’t do anything automatically to reduce its size. Luckily there is another tool for that, but you’ll have to be root to run it:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo su -&lt;br /&gt;
hdiutil compact /Volumes/TimeMachine/YourBackup.sparsebundle&lt;/blockquote&gt;
&lt;div&gt;
Sample output:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Starting to compact…&lt;br /&gt;
Reclaiming free space…&lt;br /&gt;
...................................................&lt;br /&gt;
Finishing compaction…&lt;br /&gt;
Reclaimed 3.1 GB out of 304.1 GB possible.&lt;/blockquote&gt;
&lt;div&gt;
That’s it! In this example I reclaimed 3.1GB of actual disk space on my TimeMachine volume.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
The following bash script will remove the oldest backup and reclaim the free space:&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
COMPUTER_NAME=$(/usr/sbin/scutil --get ComputerName)&lt;br /&gt;
NBACKUPS=$(/usr/bin/tmutil listbackups | /usr/bin/grep &quot;$COMPUTER_NAME&quot; | /usr/bin/wc -l)&lt;br /&gt;
OLDEST_BACKUP=$(/usr/bin/tmutil listbackups | /usr/bin/grep &quot;$COMPUTER_NAME&quot; | /usr/bin/head -n1)&lt;br /&gt;
LATEST_BACKUP=$(/usr/bin/tmutil latestbackup)&lt;br /&gt;
echo Latest backup: $LATEST_BACKUP&lt;br /&gt;
if [[ -n &quot;$LATEST_BACKUP&quot; &amp;amp;&amp;amp; &quot;$LATEST_BACKUP&quot; != &quot;$OLDEST_BACKUP&quot; ]]&lt;br /&gt;
then&lt;br /&gt;
&amp;nbsp; &amp;nbsp; echo &quot;$NBACKUPS backups. Delete oldest: ${OLDEST_BACKUP##*/} [y/N]? \c&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; read answer&lt;br /&gt;
&amp;nbsp; &amp;nbsp; case $answer in&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;&amp;nbsp; y*)&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp; echo Running: /usr/bin/sudo /usr/bin/tmutil delete &quot;$OLDEST_BACKUP&quot;&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp; /usr/bin/sudo time /usr/bin/tmutil delete &quot;$OLDEST_BACKUP&quot;&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;echo &quot;Do you wish to reclaim the free space now? [y/N]? \c&quot;&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;read answer&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;case $answer in&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp; &amp;nbsp; y*)&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;mkdir -p /Volumes/TM&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;mount_afp &#39;afp://user:pass@afp_server_address/share_name&#39; /Volumes/TM&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;hdiutil compact &quot;/Volumes/TM/$(scutil --get ComputerName).sparsebundle&quot;&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;umount /Volumes/TM/&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp; &amp;nbsp; ;;&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp; &amp;nbsp; *)&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;echo No change&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp; &amp;nbsp; ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; esac&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;&amp;nbsp; ;;&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;&amp;nbsp; *)&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp; echo No change&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;&amp;nbsp; ;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; esac&lt;br /&gt;
else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; echo &quot;No backup available for deletion&quot;&lt;br /&gt;
fi&lt;/blockquote&gt;
&lt;div&gt;
In the script above, don&#39;t forget to change the afp URL &lt;span style=&quot;font-size: xx-small;&quot;&gt;(afp://user:pass@afp_server_address/share_name)&lt;/span&gt; to your own.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/638554985537654402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/manage-time-machine-backups.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/638554985537654402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/638554985537654402'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/manage-time-machine-backups.html' title='Manage time machine backups'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-4655689410168531209</id><published>2014-07-23T21:41:00.001+01:00</published><updated>2014-07-23T21:41:11.632+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Sorry, Command-not-found Has Crashed</title><content type='html'>&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
When you try to execute a command that is not installed Ubuntu tries to hint you on the package that you should install but some times, especially after an upgrade, you get an error message saying:&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
Sorry, command-not-found has crashed! Please file a bug report at:&lt;br /&gt;(...)&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
This solves the problem:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
export LANGUAGE=en_US.UTF-8&lt;br /&gt;export LANG=en_US.UTF-8&lt;br /&gt;export LC_ALL=en_US.UTF-8&lt;br /&gt;locale-gen en_US.UTF-8&lt;br /&gt;sudo dpkg-reconfigure locales&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/4655689410168531209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/sorry-command-not-found-has-crashed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/4655689410168531209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/4655689410168531209'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/sorry-command-not-found-has-crashed.html' title='Sorry, Command-not-found Has Crashed'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-4428480354366520933</id><published>2014-07-23T21:36:00.003+01:00</published><updated>2014-07-23T21:36:31.657+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Backups"/><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Mac OS X"/><category scheme="http://www.blogger.com/atom/ns#" term="Time Machine"/><title type='text'>Ubuntu as Time Machine server</title><content type='html'>This guide will help you to install and configure the netatalk servise on an Ubuntu server so it can function as a Time Machine backup server for your Mac OS machines.&lt;br /&gt;
&lt;br /&gt;
First install the necessary packages:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo apt-get install netatalk avahi-daemon libnss-mdns&lt;/blockquote&gt;
Open the netatalk default configuration file:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo vi /etc/default/netatalk&lt;/blockquote&gt;
Modify the lines:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
ATALKD_RUN=yes&lt;br /&gt;PAPD_RUN=no&lt;br /&gt;CNID_METAD_RUN=yes&lt;br /&gt;AFPD_RUN=yes&lt;br /&gt;TIMELORD_RUN=no&lt;br /&gt;A2BOOT_RUN=no&lt;/blockquote&gt;
Edit the atalkd.conf file:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo vi /etc/netatalk/atalkd.conf&lt;/blockquote&gt;
add to the bottom&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
eth0&lt;/blockquote&gt;
Edit the AppleVolumes.default file:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo vi /etc/netatalk/AppleVolumes.default&lt;/blockquote&gt;
add to the bottom:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
/backups/timemachine &quot;Time Machine&quot; allow:@admin cnidscheme:cdb volsizelimit:200000 options:usedots,upriv,tm&lt;/blockquote&gt;
The example above also limits the size shown to OS X as 200 GB (the number is given in MiB, so it&#39;s 200,000 times 1024 in the real world)&lt;br /&gt;
&lt;br /&gt;
Edit the afpd configuration file:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo vi &amp;nbsp;/etc/netatalk/afpd.conf&lt;/blockquote&gt;
add to the bottom:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
- -transall -uamlist uams_dhx.so,uams_dhx2.so -nosavepassword -advertise_ssh -mimicmodel TimeCapsule6,106 -setuplog &quot;default log_warn &amp;nbsp;/var/log/afpd.log&quot;&lt;/blockquote&gt;
&lt;br /&gt;
Create a configuration file for the avahi afpd discovery:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo vi &amp;nbsp;/etc/avahi/services/afpd.service&lt;/blockquote&gt;
and enter the following into it:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;lt;?xml version=&quot;1.0&quot; standalone=&#39;no&#39;?&amp;gt;&amp;lt;!--*-nxml-*--&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE service-group SYSTEM &quot;avahi-service.dtd&quot;&amp;gt;&lt;br /&gt;&amp;lt;service-group&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;name replace-wildcards=&quot;yes&quot;&amp;gt;%h&amp;lt;/name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;service&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;type&amp;gt;_afpovertcp._tcp&amp;lt;/type&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;port&amp;gt;548&amp;lt;/port&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;/service&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;service&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;type&amp;gt;_device-info._tcp&amp;lt;/type&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;port&amp;gt;0&amp;lt;/port&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;txt-record&amp;gt;model=MacPro&amp;lt;/txt-record&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;lt;/service&amp;gt;&lt;br /&gt;&amp;lt;/service-group&amp;gt;&amp;nbsp;&lt;/blockquote&gt;
Restart the services:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo service netatalk restart&lt;br /&gt;sudo service avahi-daemon restart&lt;/blockquote&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/4428480354366520933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/ubuntu-as-time-machine-server.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/4428480354366520933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/4428480354366520933'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/ubuntu-as-time-machine-server.html' title='Ubuntu as Time Machine server'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-9126262921175483445</id><published>2014-07-19T19:29:00.000+01:00</published><updated>2014-07-19T19:29:07.539+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Databases"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="Oracle"/><title type='text'>MySQL and Oracle command equivalents</title><content type='html'>MySQL has specific commands, which provides the easy access to the information_schema database, to get the schema level details. But oracle does not provide such easy access to some of the schema level meta data.&lt;br /&gt;
&lt;br /&gt;
Here are &amp;nbsp;some MySQL specific commands/Syntaxes &amp;amp; equivalent Oracle techniques:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;To get the list of databases&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
MySQL :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
show databases&lt;/blockquote&gt;
Oracle :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
SELECT username FROM all_users ORDER BY username;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;To get the current schema&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
MySQL :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
select DATABASE();&lt;/blockquote&gt;
Oracle :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
SELECT sys_context(&#39;USERENV&#39;, &#39;CURRENT_SCHEMA&#39;) FROM dual;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;To get the list of tables within the current database&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
MySQL :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
use database_name;&lt;br /&gt;show tables;&lt;/blockquote&gt;
Oracle :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
select * from user_tables;&lt;/blockquote&gt;
Here schema is based on the connected username, so it is selected during the creation of the connection.&lt;br /&gt;
USER_TABLES will have a row for every table in your schema. If you are looking for the tables in your schema, this would be the correct query. If you are looking for the tables in some other schema, this is not the right table to use.&lt;br /&gt;
&lt;br /&gt;
ALL_TABLES will have a row for every table you have access to regardless of schema. You would, presumably, want to qualify the query by specifying the name of the schema you are interested in, i.e.&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
SELECT table_name&lt;br /&gt;&amp;nbsp; FROM all_tables&lt;br /&gt;&amp;nbsp;WHERE owner = &amp;lt;&amp;lt;name of schema&amp;gt;&amp;gt;&lt;/blockquote&gt;
Of course, that assumes that you have at least SELECT access on every table in that schema. If that is not the case, then you would need to use DBA_TABLES (which would require that the DBA grant you access to that table), i.e.&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
SELECT table_name&lt;br /&gt;&amp;nbsp; FROM dba_tables&lt;br /&gt;&amp;nbsp;WHERE owner = &amp;lt;&amp;lt;name of schema&amp;gt;&amp;gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;To get the connected connection info&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
MySQL :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
show processlist&lt;/blockquote&gt;
Oracle :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
SELECT sess.process, sess.status, sess.username, sess.schemaname, sql.sql_text FROM v$session sess, v$sql sql WHERE sql.sql_id(+) = sess.sql_id AND sess.type = &#39;USER&#39;;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;To limit the selection&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
MySQL :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
select * from user limit 10;&lt;/blockquote&gt;
Oracle :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
select * from table_name where ROWNUM &amp;lt;= 10;&lt;/blockquote&gt;
&lt;b&gt;To select rows which is somewhere middle&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
MySQL :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
select username from user limit 10, 15;&lt;/blockquote&gt;
Oracle :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
select element_name from (select element_name, ROWNUM as row_number from table_name) as t1 where t1.row_number &amp;gt; 10 and t1.row_number &amp;lt;= 15;&amp;nbsp;&lt;/blockquote&gt;
&lt;b&gt;Note:&lt;/b&gt; Here we have to use SubQuery rather than call it directly as &quot;select element_name from table_name as t1 where ROWNUM &amp;gt; 10 and ROWNUM &amp;lt;= 15;&quot;. This cannot be done as these ROWNUMs are assigned once they are satisfied the given conditions, which follows the WHERE. Since condition &quot;ROWNUM &amp;gt; 10 and ROWNUM &amp;lt;= 15&quot; will never be satisfied from the start ROWNUMs will never be incremented. So we need to use the Subqueries to let the ROWNUMs assigned within the Subquery and later filter the required results from the outside query.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Describe table has a same syntax in both MySQL &amp;amp; Oracle.&lt;/b&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
desc table_name;&lt;/blockquote&gt;
&lt;b&gt;To view errors/warnings&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
MySQL :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
show warings / show errors&lt;/blockquote&gt;
Oracle :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
select * from user_errors;/ show errors&lt;/blockquote&gt;
&lt;b&gt;MySQL has auto_increment Columns&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
MySQL :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
create table table_name (element_id int AUTO_INCREMENT primary, element_name varchar(20));&lt;/blockquote&gt;
Oracle :&lt;br /&gt;
i) Create table without the auto_increment keywords (because it does not exist in Oracle)&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
create table table_name (element_id int primary, element_name varchar(20));&lt;/blockquote&gt;
ii) Create a sequence, which provides the incremented values&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
create sequence auto_incrementor;&lt;/blockquote&gt;
iii) Create a trigger, which gets the next value from the sequence and updates it to the column to be auto_incremented&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
CREATE TRIGGER trig_incrementor BEFORE INSERT ON table_name&lt;br /&gt;FOR EACH ROW&lt;br /&gt;BEGIN&lt;br /&gt;SELECT auto_incrementer.NEXTVAL into :new.element_id FROM dual;&lt;br /&gt;END;&lt;/blockquote&gt;
&lt;b&gt;To get the table create script back&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
MySQL :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
show create table table_name;&lt;/blockquote&gt;
Oracle :&lt;br /&gt;
Make sure that the select_catalog_role is already available for the given user if not assign the role, as shown below.&lt;br /&gt;
grant select_catalog_role to [username];Increase the page size and maximum width for displaying the results so that complete table definition can be displayed in the sqlplus console.&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
set pagesize 999&lt;br /&gt;set long 9000&lt;br /&gt;select dbms_metadata.get_ddl(&#39;TABLE&#39;, &#39;TABLE_NAME&#39;, &#39;database_name&#39;) from dual;&lt;/blockquote&gt;
&lt;b&gt;To get the session variables&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
MySQL :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
show variables; or show variables like &#39;inno%&#39;;&lt;/blockquote&gt;
Oracle :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
SELECT name, value FROM gv$parameter; or SELECT sys_context(&#39;USERENV&#39;, ) FROM dual;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;b&gt;Explain the execution plan of a sql statement&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
MySQL :&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
explain select * from table_name;&lt;/blockquote&gt;
Oracle :&lt;br /&gt;
&lt;br /&gt;
i) First execute the explain plan so that it will fill the plan_table (this table need to be created according to the standard plan_table format, if it does not exist already)&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
explain plan select * from table_name;&lt;/blockquote&gt;
ii) Now the results of the explain plan will be populated in the plan_table, so we need to use a row connecting query to get a readable summary of the results.&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
select substr (lpad(&#39; &#39;, level-1) || operation || &#39; (&#39; || options || &#39;)&#39;,1,30 ) &quot;Operation&quot;, object_name &quot;Object&quot; from plan_table start with id = 0 connect by prior id=parent_id;&lt;/blockquote&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/9126262921175483445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/mysql-and-oracle-command-equivalents.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/9126262921175483445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/9126262921175483445'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/mysql-and-oracle-command-equivalents.html' title='MySQL and Oracle command equivalents'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-6810032643545400675</id><published>2014-07-17T19:16:00.000+01:00</published><updated>2014-07-17T19:17:09.619+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Databases"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="PostgreSQL"/><title type='text'>MySQL and Postgres command equivalents</title><content type='html'>&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;b&gt;Task&lt;/b&gt;: list existing databases, connect to one of the databases, then list existing tables and finally show the structure of one of the tables.&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;b&gt;In Mysql:&lt;/b&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
show databases;&lt;br /&gt;
use database;&lt;br /&gt;
show tables;&lt;br /&gt;
describe table;&lt;br /&gt;
exit&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;b&gt;In PostgreSQL:&lt;/b&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
\l&lt;br /&gt;
\c database&lt;br /&gt;
\dt&lt;br /&gt;
\d+ table&lt;br /&gt;
\q&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/6810032643545400675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/mysql-and-postgres-command-equivalents.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/6810032643545400675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/6810032643545400675'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/mysql-and-postgres-command-equivalents.html' title='MySQL and Postgres command equivalents'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-1795479388492481818</id><published>2014-07-16T22:44:00.002+01:00</published><updated>2014-07-16T22:45:44.187+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="dovecot"/><category scheme="http://www.blogger.com/atom/ns#" term="IMAP"/><category scheme="http://www.blogger.com/atom/ns#" term="telnet"/><title type='text'>Test imap using telnet</title><content type='html'>&lt;div class=&quot;tr_bq&quot;&gt;
For added security, you can encrypt your IMAP connection. This requires that your server supports SSL or TLS and that you have access to an SSL/TLS client program, for example OpenSSL, to use instead of telnet.&lt;/div&gt;
&lt;br /&gt;
As the port-number normally is 993, an example OpenSSL command would be openssl s_client -connect imap.example.com:993 -quiet. (If you would like to see the public key of the server, as well as some other encryption-related information, omit -quiet.) The server should then start an IMAP session, displaying a greeting such as the * OK Dovecot ready example below.&lt;br /&gt;
&lt;blockquote&gt;
telnet imap.example.com 143&lt;br /&gt;
&lt;br /&gt;
#output: Trying 193.136.28.29...&lt;br /&gt;
#output: Connected to imap.example.com.&lt;br /&gt;
#output: Escape character is &#39;^]&#39;.&lt;br /&gt;
#output: * OK Dovecot ready.&lt;br /&gt;
&lt;br /&gt;
a1 LOGIN MyUsername MyPassword&lt;br /&gt;
#output: a1 OK Logged in.&lt;br /&gt;
&lt;br /&gt;
a2 LIST &quot;&quot; &quot;*&quot;&lt;br /&gt;
#output: * LIST (\HasNoChildren) &quot;.&quot; &quot;INBOX&quot;&lt;br /&gt;
#output: a2 OK List completed.&lt;br /&gt;
&lt;br /&gt;
a3 EXAMINE INBOX&lt;br /&gt;
#output: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)&lt;br /&gt;
#output: * OK [PERMANENTFLAGS ()] Read-only mailbox.&lt;br /&gt;
#output: * 1 EXISTS&lt;br /&gt;
#output: * 1 RECENT&lt;br /&gt;
#output: * OK [UNSEEN 1] First unseen.&lt;br /&gt;
#output: * OK [UIDVALIDITY 1257842737] UIDs valid&lt;br /&gt;
#output: * OK [UIDNEXT 2] Predicted next UID&lt;br /&gt;
#output: a3 OK [READ-ONLY] Select completed.&lt;br /&gt;
&lt;br /&gt;
a4 FETCH 1 BODY[]&lt;br /&gt;
#output: * 1 FETCH (BODY[] {405}&lt;br /&gt;
#output: Return-Path: sender@example.com&lt;br /&gt;
#output: Received: from client.example.com ([192.0.2.1])&lt;br /&gt;
#output: &amp;nbsp; &amp;nbsp;by mx1.example.com with ESMTP&lt;br /&gt;
#output: &amp;nbsp; &amp;nbsp;id &amp;lt;20040120203404.CCCC18555.mx1.example.com@client.example.com&amp;gt;&lt;br /&gt;
#output: &amp;nbsp; &amp;nbsp;for &amp;lt;recipient@example.com&amp;gt;; Tue, 20 Jan 2004 22:34:24 +0200&lt;br /&gt;
#output: From: sender@example.com&lt;br /&gt;
#output: Subject: Test message&lt;br /&gt;
#output: To: recipient@example.com&lt;br /&gt;
#output: Message-Id: &amp;lt;20040120203404.CCCC18555.mx1.example.com@client.example.com&amp;gt;&lt;br /&gt;
#output:&lt;br /&gt;
#output: This is a test message.&lt;br /&gt;
#output: )&lt;br /&gt;
#output: a4 OK Fetch completed.&lt;br /&gt;
&lt;br /&gt;
a5 LOGOUT&lt;br /&gt;
#output: * BYE Logging out&lt;br /&gt;
#output: a5 OK Logout completed.&lt;/blockquote&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/1795479388492481818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/test-imap-using-telnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/1795479388492481818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/1795479388492481818'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/test-imap-using-telnet.html' title='Test imap using telnet'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-2317644854773277126</id><published>2014-07-16T22:34:00.002+01:00</published><updated>2014-07-16T22:34:56.725+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apache"/><category scheme="http://www.blogger.com/atom/ns#" term="proxy"/><category scheme="http://www.blogger.com/atom/ns#" term="webserver"/><title type='text'>Source IP based reverse proxy</title><content type='html'>If you want to proxy some source IP ranges/subnets to one server and onther subnets to go to a different server, you can do this using mod_rewrite for proxying. You will have to setup a rewrite condition based on the source IP and a rewrite rule with the [P] flag. Something like this should work:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
RewriteCond %{REMOTE_ADDR} ^10\.2\.&lt;br /&gt;
RewriteRule ^/(.*) http://old-app/$1 [P]&lt;br /&gt;
ProxyPassReverse / http://serverA/&lt;br /&gt;
&lt;br /&gt;
RewriteCond %{REMOTE_ADDR} ^10\.3\.&lt;br /&gt;
RewriteRule ^/(.*) http://new-app/$1 [P]&lt;br /&gt;
ProxyPassReverse / http://serverB/&lt;/blockquote&gt;
One possible scenario for this if you want to migrate your users from server A to server B but you want to migrate one IP range at the time.&lt;br /&gt;
&lt;br /&gt;
If you&#39;re using Apache 2.4 or newer you can also achieve this with the following configuration:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;lt;If &quot;-R &#39;10.2.0.0/16&#39;&quot;&amp;gt;&lt;br /&gt;&amp;nbsp; ProxyPassReverse&amp;nbsp;/ /http://serverA/&lt;br /&gt;&amp;lt;/If&amp;gt;&lt;br /&gt;&amp;lt;ElseIf &quot;-R &#39;10.3.0.0/16&#39;&quot;&amp;gt;&lt;br /&gt;&amp;nbsp; ProxyPassReverse / /http://serverB/&lt;br /&gt;&amp;lt;/ElseIf&amp;gt;&lt;br /&gt;&amp;lt;Else&amp;gt;&lt;br /&gt;&amp;nbsp; ProxyPassReverse / /http://serverC/&lt;br /&gt;&amp;lt;/Else&amp;gt;&lt;/blockquote&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/2317644854773277126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/source-ip-based-reverse-proxy.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/2317644854773277126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/2317644854773277126'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/source-ip-based-reverse-proxy.html' title='Source IP based reverse proxy'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-1172857633143274649</id><published>2014-07-15T14:50:00.000+01:00</published><updated>2014-07-16T22:37:28.799+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apache"/><category scheme="http://www.blogger.com/atom/ns#" term="proxy"/><category scheme="http://www.blogger.com/atom/ns#" term="Tomcat"/><category scheme="http://www.blogger.com/atom/ns#" term="webserver"/><title type='text'>Preserving client ip with apache reverse proxy</title><content type='html'>&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
The first thing that I thought of was the “X-Forwarded-For” headers, which is an HTTP header inserted into the original HTTP GET request whose value is equal to the client’s public IP. Turns out apache reverse proxy inserts this header by default. So we somehow need to instruct the backend server itself to provide the application with the correct client IP.&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
If your backend server is a Tomcat server the solution cam be using the RemoteIP tomcat valve.&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
It’s quite simple to configure in that all that needs to be done is to modify tomcat server.xml to recognise original client IP rather than the proxy IP by adding the following to server.xml:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&amp;lt;Valve className=&quot;org.apache.catalina.valves.RemoteIpValve&quot; internalProxies=&quot;127\.0\.0\.1&quot; /&amp;gt;&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
make sure to change 127.0.0.1 to the address of the apache reverse proxy.&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
The application could now recognise the original client IP.&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
The apache equivalent of the above method is using mod_rpaf for Apache 1.3 &amp;amp; 2.2.x and mod_remoteip for Apache 2.4 and 2.5.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
These apache modules can be used to preserve both remote IP/HOST. Internally they use X-Forwarded-For header to detect a proxy in it’s list of known proxies and reset the headers accordingly. This works with any proxy server in the front end provided that the proxy server sets X-Forwarded-For header.&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
To use mod_rpaf, install and enable it in the backend server and add following directives in the module’s configuration:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
RPAFenable On&lt;br /&gt;
RPAFsethostname On&lt;br /&gt;
RPAFproxy_ips 127.0.0.1&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
Remote IP is automatically preserved when RPAFenable On directive is used. RPAFsethostname On directive should be used to preserve host and RPAFproxy_ips is the list of known proxy ips.&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
Restart backend apache server and you are good to go.&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
For mod_remoteip, it’s a bit similar, the configuration should look something lke this:&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
RemoteIPHeader X-Real-IP&lt;br /&gt;
RemoteIPInternalProxy 1.2.3.4&lt;br /&gt;
RemoteIPInternalProxy 5.6.7.8&lt;/blockquote&gt;
&lt;div&gt;
mod_remoteip however has a lot more configuration options.&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;div&gt;
When the proxy server is an Apache, ProxyPreserveHost directive in mod_proxy can be used to preserve the remote host not the remote ip. This is useful for situations where name based virtual hosting is used and the backend server needs to know the virtual name of host.&lt;/div&gt;
&lt;div&gt;
Open mod_proxy configuration file of your proxy server and enter directive, ProxyPreserveHost On, and restart your apache instance.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/1172857633143274649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/preserving-client-ip-with-apache.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/1172857633143274649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/1172857633143274649'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/preserving-client-ip-with-apache.html' title='Preserving client ip with apache reverse proxy'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-3452306996647260817</id><published>2014-07-10T19:14:00.000+01:00</published><updated>2014-07-10T19:14:07.011+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Networking"/><title type='text'>Finding external IP using the command line</title><content type='html'>&lt;div&gt;
&lt;div&gt;
The easiest way is to use an external service via a commandline browser or download tool. Since wget is available by default in Ubuntu, we can use that.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To find your ip, use:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
wget -qO- http://ipecho.net/plain ;&lt;/blockquote&gt;
&lt;div&gt;
You can do the same using curl:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
curl ipecho.net/plain ; echo&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/3452306996647260817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/finding-external-ip-using-command-line.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/3452306996647260817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/3452306996647260817'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/finding-external-ip-using-command-line.html' title='Finding external IP using the command line'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-3691904221478330155</id><published>2014-07-09T14:13:00.001+01:00</published><updated>2014-07-09T14:13:41.115+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Networking"/><title type='text'>How to test a listening TCP/UDP port through nc</title><content type='html'>&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
Netcat (nc) can also be used for a lot of other purposes. It can also be used as a very fast basic port scanner,&amp;nbsp;you can scan a port or a range.&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br clear=&quot;none&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
To scan a range of UDP ports 1 to 1000:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
nc -vzu destination_ip 1-1000&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
To scan a range of TCP ports 1 to 1000&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
nc -vz destination_ip 1-1000&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br clear=&quot;none&quot; /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/3691904221478330155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/how-to-test-listening-tcpudp-port.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/3691904221478330155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/3691904221478330155'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/07/how-to-test-listening-tcpudp-port.html' title='How to test a listening TCP/UDP port through nc'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-7122417196126574147</id><published>2014-06-26T00:48:00.000+01:00</published><updated>2014-06-26T00:51:49.772+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ftp"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="services"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Install Vsftpd on Ubuntu</title><content type='html'>&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
On my &lt;a href=&quot;http://sysadminnotebook.blogspot.pt/2014/06/enable-userdir-apache-module-on-ubuntu.html&quot; target=&quot;_blank&quot;&gt;last post&lt;/a&gt; I&#39;ve talked about enabling the userdir module on Apache, you can use vsftpd to give your users FTP access to their own pages, this is hoe you can install it:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
aptitude -y install vsftpd&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
Then edit it&#39;s configuration file:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
vi /etc/vsftpd.conf&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
And make the following changes:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
# line 29: uncomment&lt;br /&gt;
write_enable=YES&lt;br /&gt;
# line 97,98: uncomment ( allow ascii mode transfer )&lt;br /&gt;
ascii_upload_enable=YES&lt;br /&gt;
ascii_download_enable=YES&lt;br /&gt;
# line 120: uncomment ( enable chroot )&lt;br /&gt;
chroot_local_user=YES&lt;br /&gt;
# line 121: uncomment ( enable chroot list )&lt;br /&gt;
chroot_list_enable=YES&lt;br /&gt;
# line 123: uncomment ( enable chroot list )&lt;br /&gt;
chroot_list_file=/etc/vsftpd.chroot_list&lt;br /&gt;
# line 129: uncomment&lt;br /&gt;
ls_recurse_enable=YES&lt;br /&gt;
# add at the last line&lt;br /&gt;
# specify root directory ( if don&#39;t specify, users&#39; home directory equals FTP home directory)&lt;br /&gt;
#local_root=public_html&lt;br /&gt;
# turn off seccomp filter&lt;br /&gt;
seccomp_sandbox=NO&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
Edit the list of users that can access your server.&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
vi /etc/vsftpd.chroot_list&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
Add the users you allow to move over their home directory&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
Finally restart the FTP service:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
service vsftpd restart&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/7122417196126574147/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/06/install-vsftpd-on-ubuntu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/7122417196126574147'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/7122417196126574147'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/06/install-vsftpd-on-ubuntu.html' title='Install Vsftpd on Ubuntu'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-7204813996877172120</id><published>2014-06-26T00:10:00.001+01:00</published><updated>2014-06-26T00:51:40.759+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apache"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Enable userdir Apache module on Ubuntu</title><content type='html'>&lt;span style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;First activate the module:&lt;/span&gt;&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
sudo a2enmod userdir&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
now edit the module&#39;s conf file:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
sudo vi&amp;nbsp;/etc/apache2/mods-enabled/userdir.conf&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
and change the line:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
AllowOverride FileInfo AuthConfig Limit Indexes&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
to&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
AllowOverride All&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
By default&amp;nbsp;&amp;nbsp;PHP is explicitly turned off in user directories, to enable it edit the php module conf file:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
sudo&amp;nbsp;vi /etc/apache2/mods-enabled/php5.conf&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
and comment out the following lines:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
#&amp;lt;IfModule mod_userdir.c&amp;gt;&lt;br /&gt;
# &amp;nbsp; &amp;nbsp;&amp;lt;Directory /home/*/public_html&amp;gt;&lt;br /&gt;
#&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp; &amp;nbsp;php_admin_flag engine Off&lt;br /&gt;
# &amp;nbsp; &amp;nbsp;&amp;lt;/Directory&amp;gt;&lt;br /&gt;
#&amp;lt;/IfModule&amp;gt;&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
Now just restart your apache srerver and that&#39;s it:&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
sudo service apache2 restart&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
You can now create a public_html folder on every users homes with the following script:&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
#!/bin/bash&lt;br /&gt;
for I in /home/*; do&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;if [ ! -d $I/$FOLDER ]; then&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;mkdir -p $I/$FOLDER&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;U=$(basename $I)&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;chown $U $I/$FOLDER&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;chgrp $U $I/$FOLDER&lt;br /&gt;
&lt;img class=&quot;tab&quot; style=&quot;display: inline-block; height: 0px; margin-left: 12px; width: 0px;&quot; /&gt;&amp;nbsp;fi&lt;br /&gt;
done # for&lt;/blockquote&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
Now if you whant to go further and create dynamic vhost for each of your users you can change your default virtual host with something like this:&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; RewriteEngine on&lt;br /&gt;
&amp;nbsp; &amp;nbsp; RewriteMap lowercase int:tolower&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # allow CGIs to work&lt;br /&gt;
&amp;nbsp; &amp;nbsp; RewriteCond %{REQUEST_URI} !^/cgi-bin/&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # check the hostname is right so that the RewriteRule works&lt;br /&gt;
&amp;nbsp; &amp;nbsp; RewriteCond ${lowercase:%{SERVER_NAME}} ^[a-z-]+\.example\.com$&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # concatenate the virtual host name onto the start of the URI&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # the [C] means do the next rewrite on the result of this one&lt;br /&gt;
&amp;nbsp; &amp;nbsp; RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; # now create the real file name&lt;br /&gt;
&amp;nbsp; &amp;nbsp; RewriteRule ^([a-z-]+)\.example\.com/(.*) /home/$1/public_html/$2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;Location / &amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Order allow,deny&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; allow from all&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/Location&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; DocumentRoot /var/www/&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;Directory /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Options FollowSymLinks&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AllowOverride None&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;Directory /var/www/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Options Indexes FollowSymLinks MultiViews&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AllowOverride None&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Order allow,deny&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; allow from all&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# define the global CGI directory&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;Directory &quot;/usr/lib/cgi-bin&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AllowOverride None&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Order allow,deny&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Allow from all&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;/blockquote&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: &#39;DejaVu Sans&#39;; orphans: 2; widows: 2;&quot;&gt;
This will allow you to use user.example.com to access your user&#39;s pages.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/7204813996877172120/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/06/enable-userdir-apache-module-on-ubuntu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/7204813996877172120'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/7204813996877172120'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/06/enable-userdir-apache-module-on-ubuntu.html' title='Enable userdir Apache module on Ubuntu'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-3654930204881207396</id><published>2014-06-17T12:05:00.000+01:00</published><updated>2014-06-17T12:40:50.544+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bash"/><category scheme="http://www.blogger.com/atom/ns#" term="firewall"/><category scheme="http://www.blogger.com/atom/ns#" term="iptables"/><category scheme="http://www.blogger.com/atom/ns#" term="Scripting"/><title type='text'>IPTables debugging</title><content type='html'>The following command will only show rules that have the action set to DROP or REJECT and omit the rules that didn&#39;t had any matches:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;
watch -n1 &quot;iptables -nvL | grep -i &#39;DROP\|REJECT\&#39; | egrep -v &#39;^\s*0\s*0&#39;&quot;&lt;/blockquote&gt;
&lt;div&gt;
This one does the same but with some colour highlighting, it will only show rules with matches, the words DROP and REJECT will appear in red and the word ACCEPT will be in green:&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;
watch --color -n1 &quot;iptables -nvL | egrep -v &#39;^\s*0\s*0&#39; | sed &#39;s/\(DROP\|REJECT\)/\x1b[49;31m\1\x1b[0m/g&#39; | sed &#39;s/\(ACCEPT\)/\x1b[49;32m\1\x1b[0m/g&#39;&quot;&lt;/blockquote&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/3654930204881207396/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/06/iptables-debugging.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/3654930204881207396'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/3654930204881207396'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/06/iptables-debugging.html' title='IPTables debugging'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-1694826203825624088</id><published>2014-06-16T19:43:00.000+01:00</published><updated>2014-06-16T19:43:23.332+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Networking"/><title type='text'>Using the IP command</title><content type='html'>The command /bin/ip has been around for some time now. But people continue using the older command /sbin/ifconfig. ifconfig won&#39;t go away quickly, but its newer version, ip, is more powerful and will eventually replace it.&lt;br /&gt;
So here are the basics of the new ip command.&lt;br /&gt;
&lt;br /&gt;
Assign a IP Address to Specific Interface:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo ip addr add 192.168.50.5 dev eth1&amp;nbsp;&lt;/blockquote&gt;
Check an IP Address:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo ip addr show&amp;nbsp;&lt;/blockquote&gt;
Remove an IP Address:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo ip addr del 192.168.50.5/24 dev eth1&amp;nbsp;&lt;/blockquote&gt;
Enable Network Interface:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo ip link set eth1 up&amp;nbsp;&lt;/blockquote&gt;
Disable Network Interface:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo ip link set eth1 down&amp;nbsp;&lt;/blockquote&gt;
&amp;nbsp;Check Route Table:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo ip route show&amp;nbsp;&lt;/blockquote&gt;
Add Static Route:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo ip route add 10.10.20.0/24 via 192.168.50.100 dev eth0&amp;nbsp;&lt;/blockquote&gt;
Remove Static Route:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo ip route del 10.10.20.0/24&amp;nbsp;&lt;/blockquote&gt;
Add Default Gateway:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
sudo ip route add default via 192.168.50.100&lt;/blockquote&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/1694826203825624088/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/06/using-ip-command.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/1694826203825624088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/1694826203825624088'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/06/using-ip-command.html' title='Using the IP command'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8222363368992442646.post-3494760083128082945</id><published>2014-06-15T14:59:00.001+01:00</published><updated>2014-06-15T14:59:15.170+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="auth"/><category scheme="http://www.blogger.com/atom/ns#" term="Command Line"/><category scheme="http://www.blogger.com/atom/ns#" term="LDAP"/><category scheme="http://www.blogger.com/atom/ns#" term="security"/><title type='text'>Change Root DN Password on OpenLDAP</title><content type='html'>First, we need to locate the credentials information of the administrator account in the correct database within the LDAP tree.&lt;br /&gt;
&lt;br /&gt;
This can be done using the ldapsearch command:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
ldapsearch -LLL -Y EXTERNAL -H ldapi:/// -b &amp;nbsp;cn=config olcRootDN=cn=admin,dc=example,dc=com dn olcRootDN olcRootPW&lt;/blockquote&gt;
(replace the olcRootDN value with the correct value to match your configuration)&lt;br /&gt;
&lt;br /&gt;
This command will return something like:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
SASL/EXTERNAL authentication started&lt;br /&gt;SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth&lt;br /&gt;SASL SSF: 0&lt;br /&gt;dn: olcDatabase={1}hdb,cn=config&lt;br /&gt;olcRootDN: cn=admin,dc=example,dc=com&lt;br /&gt;olcRootPW: {SHA}ks1xBVfgRXavGCpkPefc9hRHL4X=&lt;/blockquote&gt;
There are two interesting information we know now:&lt;br /&gt;
&lt;br /&gt;
we need to modify the entry “dn: olcDatabase={1}hdb,cn=config“&lt;br /&gt;
the current password is hashed with SHA1 algorythm.&lt;br /&gt;
To generate our new password with the same algorythm we&#39;ll use the command slappasswd with the syntax:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
slappasswd -h &amp;lt;the hashing scheme we want to use - for example {SHA}&amp;gt;&lt;/blockquote&gt;
The system will then prompt you for the new password to use, twice, and will finally display the hashed value we’re interested in:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
root@testbox:~# slappasswd -h {SHA}&lt;br /&gt;New password:&lt;br /&gt;Re-enter new password:&lt;br /&gt;{SHA}W6ph5Mm7Ps6GglULbPgzG37mj0g=&lt;/blockquote&gt;
Then we’ll proceed to modify the entry we’ve identified above using the command:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
root@testbox:~# ldapmodify -Y EXTERNAL -H ldapi:///&lt;/blockquote&gt;
The system will start the listening mode for modifying commands:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
SASL/EXTERNAL authentication started&lt;br /&gt;SASL username: gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth&lt;br /&gt;SASL SSF: 0&lt;/blockquote&gt;
First, we enter the entry we want to modify:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
dn: olcDatabase={1}hdb,cn=config&lt;/blockquote&gt;
Second, we type in the parameter we want to modify:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
replace: olcRootPW&lt;/blockquote&gt;
Third, we type in the new password generated above (copy and paste is MUCH less error prone than manual typing at this point ;) )&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
olcRootPW: {SHA}W6ph5Mm7Ps6GglULbPgzG37mj0g=&lt;/blockquote&gt;
Hit Enter another time to commit the modification and the following line will appear:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
modifying entry &quot;olcDatabase={1}hdb,cn=config&quot;&lt;/blockquote&gt;
After this, you can exit the listening mode with CTRL+C and restart the LDAP database service using:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
service slapd stop&lt;br /&gt;service slapd start&lt;/blockquote&gt;
and login now with the new password set.</content><link rel='replies' type='application/atom+xml' href='http://sysadminnotebook.blogspot.com/feeds/3494760083128082945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/06/change-root-dn-password-on-openldap.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/3494760083128082945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8222363368992442646/posts/default/3494760083128082945'/><link rel='alternate' type='text/html' href='http://sysadminnotebook.blogspot.com/2014/06/change-root-dn-password-on-openldap.html' title='Change Root DN Password on OpenLDAP'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/16452944947893057496</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>