Friday, March 20, 2015

SOLVED: Can't establish a reliable connection to the server Google play store

A couple of days ago I faced a nasty problem with my Android phone: It was not able to sign in the Google account / store. I thaught it was a temporary issue at Google's servers and I tried a couple of hours later, but nothing changed. I tried some usual things like clearing the cache of some apps, restart the phone and even change my Google account password and I resetted the phone twice to fabrics defaults. Nothing could help.

I searched a lot of info on the internet and I found a hint about the hosts file. The hosts file is a computer file used by an operating system to map hostnames to IP addresses. I red that in some phones in the hosts file the adress to android.clients.google.com is translated to a certain IP address(es). Bang! what if Google changes the IP address for this domain?

The first thing I needed to do was to root the phone and gain permissions to open the hosts file.
I used Kingo ROOT which is a simple software to root the Android phones.

After that, I needed a file browser to browse the /etc folder and find the hosts file. But, I could not sign in to install an App for the purpose; I was able to download the app Root browser via another site and mail the app to my phone. Then I installed the app that I get as attachment in my mail.

I opened the hosts flie and I found this:


There were 2 nasty entries that translated the domain android.clients.google.com to 74.125.31.100 and 74.125.31.101

That was the problem! If I ping to this domain I get 74.125.136.139 as response.

I commented with a # the two entries, saved the file, rebooted the phone and my problem was resolved!

Friday, August 22, 2014

create a samba share and user

I found a lot of posts intended to explain how to create a samba share and user that would work even connecting from a Windows box. Unfortunately lot of these tuto's simply do not work.

I was able to do the job this way:

#this creates the user in linux
sudo useradd -s /bin/true (username)

#this will prompt you for a password
sudo smbpasswd -L -a (username)

#this enables the user
sudo smbpasswd -L -e (username)

#creates new samba user
sudo smbpasswd -a (username)

#add username to smbusers file
sudo nano /etc/samba/smbusers
(linuxusername) = '(username)'

#restart samba
sudo restart smbd
sudo restart nmbd
 
 
#Then create a samba share:

[share_name]
path = /path/to/share
read only = no
writable = yes
guest ok = no
create mask = 0755
directory mask = 0755
valid users = username

#Where the username is the username just above created

Friday, May 2, 2014

Scheduled updates with cron job

If you want to install updates on a server you may want it done at night when users are sleeping (hopefully).

That is not that difficult with a shell script and a cron job. The shell script takes care of calling all the update commands and the cron job schedules the executing and log the output to a custom log file.

First the shell script:

#!/bin/sh
echo "\nUpdate on: $(date)\n"
echo 'Update the packages list\n'
sudo /usr/bin/apt-get update >> /dev/null 2>&1
echo '\nUpgrade to latest package version\n'
sudo /usr/bin/apt-get upgrade --yes
echo '\nUpgrade the distribution\n'
sudo apt-get dist-upgrade --yes
echo '\nCleanup\n'
sudo /usr/bin/apt-get autoremove --yes
sudo /usr/bin/apt-get autoclean --yes
sudo /usr/bin/apt-get clean --yes
#
# The End
#

The script executes after all a bit of cleanup.

Put the "update.sh" script in a folder and make it executable:

$ chmod +x update.sh


Now the cron job rule:

open crontab as root:

$ sudo crontab -e

Add a line to call the "update.sh" script:

30 4 3 5 *  /home/administrator/update.sh > /home/administrator/myupdates.log

In the line above I call the "update.sh" in my administrator folder at 04:30 on May the 3rd. The output of the script will be sent to "myupdates.log" file.

After the job is executed you can check the log file and comment out the line in crontab with a #

I hope it is useful to you.