Technology and troubleshooting.

Saturday, April 30, 2016

To Check the Last Password Set using command prompt

How to check the Last Password Set Date & Time using command prompt


Goto Run and type CMD, the black dialog box will be opened and type the below command on the command prompt
 
net user username | find /I "Password last set"

Where "username" is the username to find.

Example

net user administrator | find /I "Password last set"

Result will be display like below



net user administrator | find /I "Password last set"






Hope this information will be helpful!!!

Thanks for reading this.


Share:

Restart fstab using cron

In this tutorial I am going to show you how to Restart fstab using crontab .

Restart fstab using crontab

My Scenario:-  I am running MYSQL database server in Linux recent days MYSQL backup scheduler is not running properly. I analyzed the log and i found there is problem with volume mount point. Remote volume often went offline.

Solution:-  I tried to list the volume using the below command.
[root@Techlanda.com~]#mount -l 

My remote volume not listed in the list. I had a solution for that mount -a every time open the terminal by typing the command mount -a to mount. Volume is really waste of time. So i decided to automate the task using crontab.

Note:- This is work around. I will fix this issue during non production window.

This is the command to mount all stuff from /etc/fstab.
[root@Techlanda.com~]#mount -a 

Here is scheduler to restart the mount point volume.

Step#1:- Open the crontab to fstab scheduler
[root@Techproxy ~]# crontab -e
Step#2:- fstab mount script
28 12 * * * /bin/mount -a
#Scheduler will run at every day 12:28 PM IST
After adding the line press ESC and type :wq! to save :q! to abort changes.

I hope this information is useful for you. Please forgive any typos or incomplete sentences.

Share:

Tuesday, April 26, 2016

Linux: Configure transparent proxy with squid

In this tutorial I am going to show you how to configure transparent proxy with Squid.
Squid proxy server

My Scenario:- Our management team asked me to monitor the Internet usage for those who are all using internet inside the office premises. So that, we needs to be monitor and report whey they are doing on the internet..

I got a chance to configure the Squid transparent proxy and my task is simple to setup Squid proxy as transparent server.

My Squid transparent Proxy Setup:- 
i) VMWare ESXi 5.5 Dell Server| Processor 1 Core | RAM 1 GB
ii) Static IP Address
iii) Centos 6.7 (CentOS release 6.7 (Final)
iv) Squid Cache: Version 3.1.23

Let me move on to the Squid transparent proxy configuration part:-

Step #1: Turn off the Linux firewall by using the below the command.
[root@Techproxy ~]# service iptables status [Current status of iptables]
[root@Techproxy ~]# service iptables save [save iptables configuration]
[root@Techproxy ~]# service iptables stop [Stop iptables]
[root@Techproxy ~]# chkconfig iptables off [Stop iptables during run-level or system reboot]
                                       (OR)
Configure iptables to allow squid port 3128

iptables -A INPUT -p tcp -s 0/0 –sport 1024:65535 -d 202.54.1.20 –dport 3128 -m state –state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s 192.168.1.11 –sport 3128 -d 0/0 –dport 1024:65535 -m state –state ESTABLISHED -j ACCEPT


Step #2: Install Squid Cache.
[root@Techproxy squid]# yum install squid

Step #3: Once the installation is completed make sure your squid service is running.
  • Squid service status
[root@Techproxy ~]# service squid status 
squid is stopped
Squid service is not started yet to start Squid service please use the below command.
[root@Techproxy ~]# service squid start
Starting squid: .                                          [  OK  ]
                             (OR)
[root@Techproxy ~]# service squid restart
Stopping squid: ................                           [  OK  ]
Starting squid: .                                          [  OK  ]

By default Squid Cache: Version 3.1.23 act as transparent proxy We need not do anything in the configuration part :)

That's it squid transparent proxy configuration part is completed.

Test Squid transparent proxy via telnet 

telnet 192.168.1.11 3128

If you are able to see above black screen we have a connectivity with squid proxy server

Configure squid proxy through client machine.

Tools->Internet Options->Connections Tab-> LAN Settings->Proxy server->Fill Address: & Port information



















Real time monitoring the Squid transparent proxy kindly use the below command .
[root@Techproxy squid]# tail -f /var/log/squid/access.log

I hope this information is useful for you. Please forgive any typos or incomplete sentences.

Share:

Thursday, April 21, 2016

How to terminate telnet session (Linux, Mac, Windows)

How to terminate telnet session (Linux, Mac, Windows)

This tutorial describes How to terminate or end telnet session on Linux, Mac and Windows.


Techlanda.com


My Scenario:- Every weekend I performed redundancy test for customer projects to ensure the up-time to our customer through backup internet link after the change over. I telnet the application address port whether we had a connectivity with application or not. likewise i ensure the connectivity. I had no idea how to close telnet session after i made some research and i found a key.

Answer:- Steps to end the telnet session.


Techlanda.com




Open the telnet prompt by holding down the CTRL + ] 
It will prompt the Microsoft/Linux Telnet> 
Type 'quit' (HIT Enter to abort the session)

Example Linux:- 


Techlanda.com








Example Windows:- 


Techlanda.com








That's all

I hope this information is useful for you. Please forgive any typos or incomplete sentences.



Share:

Monday, April 18, 2016

How to get email notification when cron is completed

How to get email notification when cron is completed

This tutorial describes about how to get email notification when cron is completed.



My Scenario:-We are running Database server in Linux environment recent days scheduler(Cron) is not running properly. So i decided to configure email alert when cron is completed it automatically triggered email to our IT-Group from Linux box.  

Edit the crontab by using the below command:-
[root@techlanda.com~]# crontab -e

Here is cron script:- 
30 23 * * * mysqldump -u root ITManagement> /home/sqlbac/ITManagement_Dailybackup.sql
Email notification script:- 
echo -e "Hello,\n\tMYSQL Backup has been sucessfully taken."   "\n\n Note:This is an auto-generated email from Linux server. Please do not reply to this email.\nThanks,\nRanjit"|mail -s "ITManagement MYSQL Backup" -c cc@yourdomain.com -b bcc@yourdomain.com  to1@yourdomain.com to2@yourdomain.com to3@yourdomain.com to4@yourdomain.com -- -f FromSender@yourdomain.com

Syntax:- [YOUR CRON JOB] && [MAIL FUNCTION]

Example:-  Paste the below script in the crontab:-

30 23 * * * mysqldump -u root ITManagement> /home/sqlback/ITManagement_Dailybackup.sql && echo -e "Hello,\n\tMYSQL Backup has been sucessfully taken."   "\n\n Note:This is an auto-generated email from Linux server. Please do not reply to this email.\nThanks,\nRanjit"|mail -s "ITManagement MYSQL Backup" -c cc@yourdomain.com -b bcc@yourdomain.com  to1@yourdomain.com to2@yourdomain.com to3@yourdomain.com to4@yourdomain.com -- -f FromSender@yourdomain.com

save the configuration using :wq! or abort :q!

Apply changes we must restart the cron service:-
 [root@techlanda.com ~]# /etc/init.d/crond restart

                                or
[root@techlanda.com ~]# service crond restart


Result:-

Techlanda
Cron email notification















I hope this information is useful for you. Please forgive any typos or incomplete sentences.
Share: