SSH Keys – Password less authentication

I was trying to setup SSH Keys between two different flavors of Linux Host by following this Howto

I did run commands exactly as per mentioned in the how to; but it didn’t work. Error message as under

vin@CLIENT:~$ ssh vsa@192.0.0.10
vin@192.0.0.10’s password:
Last login: Mon May 22 10:45:03 2017 from 192.0.0.10
-bash: id: command not found
-bash: id: command not found
-bash: id: command not found
-bash: tty: command not found
-bash: uname: command not found

After googling and trail and error method finally found a fix.

Instead of Step 3 as per the above How to, use the below commands.

  1. Ensure on the server proper permissions set on the .ssh folder if not set permissions as

$chmod -R 775 .ssh (.ssh is located in user home directory e.g: /home/vin)

  1. Run this command to copy the Key file from client to server

$cat ~/.ssh/id_rsa.pub | ssh vin@192.0.0.10 ‘umask 0077; /bin/mkdir -p .ssh; /bin/cat >> .ssh/authorized_keys && echo “Done!”‘

After running above command, server 192.0.0.10 do not ask for password when user vin try to login.

vin@CLIENT:~$ ssh vin@192.0.0.10
Last login: Mon May 22 11:54:29 2017 from 192.0.0.10
[vin@SERVER ~]$

Advertisements

Manage services from CLI on Linux

In Window$ OS, we can check running services and its status by going to Services console. (Start > Run > services.exe)

Similarly, to access running services info and status under Linux via BASH / Shell, we need to install ‘sysv-rc-conf’

aptitude install sysv-rc-conf

Below screenshot show the output of sysv-rc-conf command displaying status of service for all running levels (1-6) and startup (S)

2016-11-21 11_06_38-Debian1 [Running] - Oracle VM VirtualBox.png

As you can see in the screenshot to start a service use ‘+’ and to stop a service use ‘-‘. To enable or disable service to run at startup goto the respective service’s ‘S’ column and then use ‘Space Bar’.

Wire free connect to Android Phone via SSH

I left my USB Type C cable cum charger in office yesterday and couldn’t transfer some files. I am aware of Shareit app but it doesn’t work in Linux. Both my laptop and phone are connected to wireless router.

After googling for while found a native and simplest way to connect to my android phone via SSH.

Installed SSHDroid on my phone and started the SSH service. From my Debian GNU Linux console started SSH session and connected to the IP of my phone and using SCP copied all those required files from phone to PC. BTW copied new songs from PC to phone as well 🙂

Bandwidth throttling using Squid Proxy

Internet is the most important and one of the basic amenities in today’s world. Sharing internet using WiFi router with slow speeds having low bandwidth is a real pain. Plus if you end up working from home and taking Skype for Business (formerly Lync) calls then you’ll be virtually fighting with your kids & wife. They’ll be using the same internet to browse youtube, shopping sites etc which are bandwidth hungry apps.

Squid-cache_logo

 

I was aware of Squid proxy but never explored it to use it for throttling bandwidth for clients. I followed this guide to install squid on my Raspberry Pi and modified configuration file according to my requirements. Below is the configuration file of squid proxy which will throttle the internet speed / bandwidth for the clients like laptop, android phones and tablets.

#squid.conf

acl SSL_ports port 443
acl Safe_ports port 80        # http
acl Safe_ports port 21        # ftp
acl Safe_ports port 443        # https
acl Safe_ports port 70        # gopher
acl Safe_ports port 210        # wais
acl Safe_ports port 1025-65535    # unregistered ports
acl Safe_ports port 280        # http-mgmt
acl Safe_ports port 488        # gss-http
acl Safe_ports port 591        # filemaker
acl Safe_ports port 777        # multiling http
acl CONNECT method CONNECT
#http://www.tecmint.com/configure-squid-server-in-linux/
acl localhost src 127.0.0.1/32
acl localnet src 192.168.2.0/24
#Throttle bandwidth
acl clientpc src 192.168.2.90-192.168.2.100/24
delay_pools    1
delay_class    1 1
delay_parameters    1    64000/64000
delay_access    1    allow    clientpc
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localhost manager
http_access deny manager
http_access allow localnet #!clientpc
http_access allow localhost
http_access deny all
http_port 3128
coredump_dir /var/spool/squid3
refresh_pattern ^ftp:        1440    20%    10080
refresh_pattern ^gopher:    1440    0%    1440
refresh_pattern -i (/cgi-bin/|\?) 0    0%    0
refresh_pattern .        0    20%    4320

I’ve highlighted important lines in RED color above. I’ve created an acl called “clientpc” for the local network having IP address starting from 192.168.2.90 to .100. Created a default pool ‘1’ and class ‘1’. ‘delay_parameters’ for pool ‘1’ set to 64000 bytes (512KB). We can increase or decrease depending on the internet speed or bandwidth.

Enabled proxy in firefox. If you’re in stone age and still use ‘IE’ then go search for ‘proxy settings for IE’ in search engines 😛

Steps
  1. Click the Firefox menu. Select Options from the submenu.
  2. Open the Advanced category. It is on the right end of the category list. …
  3. Click the Settings button. This will open the Connection Settings window.
  4. Choose “Manual proxy configuration”. …
  5. Enter your proxy information.

Screenshot from 2016-07-24 20-24-38.png

Enabled proxy on the android phones and tablets by referring to this link.

Screenshot_20160724-202759.png

Tested internet speed via speedof.me Below screenshot shows that the download speed was successfully throttled by Squid whereas my internet connection speed is 2 Mbps. Now I can work from home with peace of mind and grabbing a largest piece of “internet” pie.

Screenshot from 2016-07-24 20-31-58

Installed “SARG” to monitor internet usage and resource utilization. I followed this link which is pretty simple and easy to set it up. SARG is optional but good to have!!

It was time consuming and eaten up my Sunday but worth to spend the time as I don’t have to crib in future about internet speed or poor voice / audio issues.

Let me know your queries using below ‘reply’ button…

Simple snapshot tool for Linux

I was looking for a simple yet powerful backup / snapshot tool which would help me in taking regular backups of my Raspberry Pi. Pi is my personal AIO server running website https://vinaybabu.in, LAMP stack, Mail server, NAS services etc…

I’ve chosen rsnapshot which is based on rsync. This tool suits perfectly for my backup / snapshot requirement and works like a charm.

Download a copy and give it a try. Happy learning and Backup-ing!!

How to quickly setup Squid Proxy?

Squid proxy is one of the best open source proxy software’s and most widely implemented solutions. I was trying to quickly set this up with less efforts but with no compromise w.r.t implementing robust ACLs (Access Control Lists).

Instead of reading various Howto’s in the net, I started searching for ready made appliance which could make things easy for me 🙂

logo

After reviewing various options, I have had decided to go with Artica Proxy. Its pretty simple and its intuitive interface makes it simple to swiftly setup Squid Proxy within few minutes.

It offers Transparent Proxy, Load Balancer, 1.6 Millions blacklisted sites (updated on daily basis), user defined ACLs etc… For a full featured characteristics and benefits please visit the URI here.

I hope you’ll find this intelligent software useful and happy proxying!!

 

Packagekitd – High Memory Usage

Packagekitd daemon was using high memory usage on the Debian Linux server. Almost 30% of the total RAM!!

Tried to identify the root cause but didn’t help. so I had to kill the process to avoid further issues on the server.

I used below commands to kill the daemon process. After this got 30% RAM free…
ps auxf | grep package
[Get the process # for packagekitd]
sudo kill [process #]
BTW, I wish all my blog readers a very happy, prosperous and peaceful new year 2016!!!