SOHO : Small Office Home Office
Freeware - Opensource software tips, tricks, tweaks & fixes for managing, securing, improving the performance of SOHO Desktop, Laptop, Networks

reset wordpress user password

On updating my wordpress user password I forgot...

Refering : https://codex.wordpress.org/Resetting_Your_Password

I opted for the ftp option but instead of downloading and uploading I logged in through ssh and edited the file. Super easy

1. Login to your site via FTP / SSH  and download or edit your active theme's functions.php file.
2. Edit the file and add this code to it, right at the beginning, after the first <?php:
wp_set_password( 'password', 1 );
Put in your own new password for the main admin user. The "1" is the user ID number in the wp_users table.
3. Upload the modified file back to your site.
4. After you then are able to login, make sure to go back and remove that code. It will reset your password on every page load until you do.
Next step is hardening wordpress
Continue Reading...

Reset dd-wrt web gui password

I changed the dd-wrt router password and could no longer access the device. Lucky, I was able to login to the router with ssh and default username and my old password. This means that the web gui password was corrupted. With the below steps I was able to gain access to the routers web gui.



  • Login to the router via ssh.
  • Type in nvram set http_passwd=
  • Then type in nvram commit
  • open browser, connect to the router and change the password "immediately"
  • Power off the router for atleast a minute and power on again.
  • login to the router and take backup of your settings.

Continue Reading...

list ppa and uninstall with ppa-purge

Remove installed ppa from ubuntu system.

  • Install  ppa-purge 
sudo apt-get install ppa-purge
  • Run command in terminal to list all configured repositories and ppa in readable format
apt-cache policy | grep http | awk '{print $2 $3}' | sort -u

  • Uninstall the ppa with syntax : sudo ppa-purge ppa:<repository-name>/<subdirectory> example in my case
sudo ppa-purge ppa:ubuntu-audio-dev/alsa-daily



  • Delete the unwanted source list from the location /etc/apt/sources.list.d. example in my case
sudo rm /etc/apt/sources.list.d/ubuntu-audio-dev-ppa-trusty.list ubuntu-audio-dev-ppa-trusty.list.save 

Continue Reading...

Regain access to lost dd-wrt webmin

I was playing with the webmin of dd-wrt and lost access to it.
  1. https://router-ip throws up connection error
  2. http://router-ip throws up invalid url

Fortunately I had the ssh port enabled.

To recover the web access, log in to the router and run the below commands.
nvram set remote_management=1
nvram set http_wanport=8080
nvram set httpsd_enable=1
nvram set https_enable=1
nvram set remote_mgt_https=1
nvram commit
reboot

I got access and lessons learned
Very important to take backup from the webaccess in the administration section and under backup
  • Direct url: http://192.168.1.1/config.asp
  • In the above case my router ip is 192.168.1.1 
Have an secure alternative access to the router ssh or telnet.
If you have an dd-wrt router working well PLEASE do take a backup of the settings.
  • IF there is a backup then life is easy.
  • Perform hard reset and recover from the backup file.
Now I have a backup file and peace of mind.
Continue Reading...

DNS-O-MATIC - waiting for first update

I have a dns-o-matic account and runnig fine. I had to add a new service and there is this issue

" waiting for the first update" 

To force update just visit the below address

https://updates.dnsomatic.com/nic/update?hostname=all.dnsomatic.com
you will be prompted by username and password. Enter the credentials and check the history for update.

By default this should be done automatically on the next dns update by dd-wrt client  but I needed to update it manually and immediately
Continue Reading...

Edit crontab with nano in centos the easyway

source :  http://myquickfix.co.uk/2013/09/edit-crontab-with-nano-on-centos-crontab-e/

Edit crontab with NANO on centos (crontab -e)
Posted September 25th, 2013 by Ben & filed under CentOS.

Problem: I don’t know where my root users crontab file is, and this doesn’t usually matter because using the command ‘crontab -e’ opens it for editing anyway… but it opens in VI and I am too stupid / lazy / in a rush to use VI.

Solution: The -e switch makes the file open in whatever the default editor for the environment is. To override this, pass the EDITOR environment var to the command when it’s run:

sudo env EDITOR=nano crontab -e
Continue Reading...

Mount HFS+ (apple) file system in ubuntu

Mount HFS+ apples file system in ubuntu

sudo apt-get install hfsplus hfsutils hfsprogs

Mount as usual.

Note: HFS file system by default will be read only to enable write mode journal has to be disabled first before removing the drive.

Continue Reading...

Find WAN / public IP from command line

There are many websites and web scripts available to know your external (WAN/INTERNET/PUBLIC) IP address. To find out the wan IP address from command line below are two simple methods

The below two methods rely on external services to detect the IP address. Any one of the listed service can be used


1) curl :

Can be installed by running command "sudo apt-get install curl". To know the IP run command
curl http://myip.dnsomatic.com

my preferred url is http://myip.dnsomatic.com  a service by opendns and can be replaced with any one of the above urls.

2) wget :

By default wget would be installed on most of the system if not can be installed with command "sudo apt-get install wget". To know the IP run command
wget http://myip.dnsomatic.com -O - -q ; echo 
Continue Reading...

Hide post time stamp blogger homepage

Post status : incomplete

How to hide post date, time stamp and author from blogger home page only.

This can be done using conditional tags to
<span class='post-author vcard'>
<span class='post-timestamp'>
<span><data:post.dateHeader/></span>

Conditional tag syntax

<b:if cond='PUT_CONDITION_HERE'>
</b:if>
It is made up of a <b:if> tag, with a  cond attribute added. Condition is entered as the value of the cond attribute. Each (opening) <b:if> tag need to be closed with a closing </b:if> tag.

The below conditional tag is specific to homepage. I only list the opening tags here. Just make sure you include the closing </b:if> tag when applying a conditional in your template. (More list of conditional tags -- todo)
<b:if cond='data:blog.url == data:blog.homepageUrl'>

Applying conditional tag

To apply a conditional tag to a content, simply put the content between the opening <b:if cond…> and the closing </b:if>, like so:
<b:if cond='data:blog.pageType == "item"'>
CONTENT (TO BE EXECUTED IF CONDITION IS TRUE)
</b:if>
In the example above, the content will only appear on post pages.
If you want to specify a alternate content (when the condition is false), you need to insert a <b:else/> tag followed by the content, like this:
<b:if cond='data:blog.pageType == "item"'>
CONTENT 1 (TO BE EXECUTED IF CONDITION IS TRUE)
<b:else/>
CONTENT 2 (TO BE EXECUTED IF CONDITION IS FALSE)
</b:if>
You can place the conditional anywhere in your template HTML, except inside a section or inside a widget content box. The content can be a div, a section, a style tag, another conditional tag etc.

Reversing a condition
A condition can be reversed simply by replacing the comparison operator from == (is equal to) to != (is not equal to), like so:
<b:if cond='data:blog.pageType != "item"'>
CONTENT (TO BE EXECUTED IF CONDITION IS TRUE)
</b:if>
In the example above, the content will only appear on pages other than post pages (i.e. removed/hidden from post pages). This method is not applicable to Label-search and First Post conditionals.

Editing the template

Go to Dashboard > Template > edit HTML
Make sure to backup a copy before you make changes.

Search for <span class='post-timestamp'>
<span class='post-timestamp'>
                <b:if cond='data:top.showTimestamp'>
                  <data:top.timestampLabel/>
                  <b:if cond='data:post.url'>
                    <meta expr:content='data:post.canonicalUrl' itemprop='url'/>
                    <a class='timestamp-link' expr:href='data:post.url' rel='bookmark' title='permanent link'><abbr class='published' expr:title='data:post.timestampISO8601' itemprop='datePublished'><data:post.timestamp/></abbr></a>
                  </b:if>
                </b:if>
              </span>
Modifiy the code as below

<span class='post-timestamp'>
                <b:if cond='data:top.showTimestamp'>
                  <data:top.timestampLabel/>

                  <b:if cond='data:blog.url != data:blog.homepageUrl'>
                    <meta expr:content='data:post.canonicalUrl' itemprop='url'/>
                    <a class='timestamp-link' expr:href='data:post.url' rel='bookmark' title='permanent link'><abbr class='published' expr:title='data:post.timestampISO8601' itemprop='datePublished'><data:post.timestamp/></abbr></a>
                  </b:if>
                </b:if>
              </span>
Search for <span class='post-author vcard'>
<div class='post-footer-line post-footer-line-1'>
              <span class='post-author vcard'>
 <b:if cond='data:blog.url != data:blog.homepageUrl'>
                <b:if cond='data:top.showAuthor'>
                  <b:if cond='data:post.authorProfileUrl'>
                    <span class='fn' itemprop='author' itemscope='itemscope' itemtype='http://schema.org/Person'>
                      <meta expr:content='data:post.authorProfileUrl' itemprop='url'/>
                      <a expr:href='data:post.authorProfileUrl' rel='author' title='author profile'>
                        <span itemprop='name'><data:post.author/></span>
                      </a>
                    </span>
Modify the code as below
<div class='post-footer-line post-footer-line-1'>              <span class='post-author vcard'> <b:if cond='data:blog.url != data:blog.homepageUrl'>                <b:if cond='data:top.showAuthor'>                  <b:if cond='data:post.authorProfileUrl'>                    <span class='fn' itemprop='author' itemscope='itemscope' itemtype='http://schema.org/Person'>                      <meta expr:content='data:post.authorProfileUrl' itemprop='url'/>                      <a expr:href='data:post.authorProfileUrl' rel='author' title='author profile'>                        <span itemprop='name'><data:post.author/></span>                      </a>                    </span>

Search for data:post.dateHeader

To remove the date stamp above your post and only from home page, edit the template, find the below code
<b:if cond='data:post.dateHeader'>
          <h2 class='date-header'><span><data:post.dateHeader/></span></h2>
        </b:if>

 Modify it to

<b:if cond='data:blog.url != data:blog.homepageUrl'>
<b:if cond='data:post.dateHeader'>
          <h2 class='date-header'><span><data:post.dateHeader/></span></h2>
        </b:if>
</b:if>
Continue Reading...

Remove offending RSA key in ~/.ssh/known_hosts file with one line command

When you ssh to a server where the host key (RSA) has changed then you will get an error message as shown in the image:



The error in the above example :
Offending RSA key in /home/username/.ssh/known_hosts:8

Looking in to the error message, we can find the offending RSA key and its position in the known_hosts file. In the above example image the offending key is at  line 8. (marked with red line). This can be fixed by deleting the offending key so that ssh lets you to connect after accepting the new key. This offending RSA key from the known_hosts file can be removed using `sed` with the following parameters:

$ sed -i '8d' ~/.ssh/known_hosts

The parameters
-i   :  For inplace editing
8d : Offending RSA key at line no 8
~/.ssh/known_hosts : path to and file known_hosts.
Continue Reading...