Showing posts with label Linux Articles. Show all posts
Showing posts with label Linux Articles. Show all posts

Sunday, 26 May 2013

How to Setup Chroot SFTP in Linux (Allow Only SFTP, not SSH)



If you want to setup an account on your system that will be used only to transfer files (and not to ssh to the system), you should setup SFTP Chroot Jail as explained in this article.
In a typical sftp scenario (when chroot sftp is not setup), if you use sftp, you can see root’s file as shown below.
If you want to give sftp access on your system to outside vendors to transfer files, you should not use standard sftp. Instead, you should setup Chroot SFTP Jail as explained below.
Non-Chroot SFTP Environment
In the following example (a typical sftp environment), abc can sftp to the system, and view /etc folder and download the files from there.
# sftp abc@xcessl0gycs.com
abc@xcessl0gycs's password:
sftp> pwd
Remote working directory: /home/abc

Thursday, 23 May 2013

What’s the Difference Between 127.0.0.0 and 127.0.0.1?



Sometimes the most elementary of questions yield teachable moments; read on as we delve into how a single digit change between 127.0.0.0 to 127.0.0.1 offers a chance to look at network topology.
The Question
What’s the Difference Between 127.0.0.0 and 127.0.0.1?
I know that both are loopback IPs, but they have another ip mask.
What’s the difference between them? Can they be used interchangeably?
===========================================================================

IPv4 routes
===========================================================================
Active routes:
Destination               Mask          Gateway        Interface Metric
      0.0.0.0          0.0.0.0      192.168.1.1      192.168.1.6     26
[...]
    127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
    127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
What kind of information can we tease out from this table?

Tuesday, 14 May 2013

20+ .htaccess Hacks Every Web Developer Should Know About


Apache's .htaccess(hypertext access) configuration file can be a very powerful tool in a web developer's toolkit if used properly. It can be found in the webroot of your server and can be easily edited using any text editor. In this article I'm going to show you 20 .htaccess hacks and how to use them.
Before I start with this article I'd like to start by saying that abusing the .htaccess file will hurt the performance of your website. The .htaccess file should only be used if you have no other way to achieve certain things.
Make sure to back up your current .htaccess file before applying any of the following hacks.

1. Prevent Hotlinking

Tired of people using your bandwidth by putting the images hosted on your server on their website? Add the following code at the bottom of your .htaccess file to prevent hotlinking.
1Options +FollowSymlinks
2#Protect against hotlinking
3RewriteEngine On
4RewriteCond %{HTTP_REFERER} !^$
5RewriteCond %{HTTP_REFERER} !^http://(www.)?domainname.com/ [nc]
6RewriteRule .*.(gif|jpg|png)$http://domainname.com/img/stop_stealing_bandwidth.gif[nc]
NOTE: The following article explains better methods to "prevent" hotlinking:
Link building secrets by Maurizio Petrone

Monday, 6 May 2013

How to check what we have Installed in Debuian/Ubuntu OS


To check what have install by listing all using dpkg is easy.
dpkg -l
To check whether a package is install also easy.
dpkg -l | grep apache
The command above is some how redundant, because dpkg support wild characters, doing this instead
dpkg -l "apache*"
By doing this, it will also list the package that not install but available in dpkg cache, to install them you can simply apt-get. To indicate the packages installed it shows “ii” and not install shows “un”.

Shell Script File for Checking Package Installed or not Or If not then Install Package - For Ubuntu OS

Dpkg: check that unix package is installed. Bash script: install package if not present

dpkg -s can be used.
Example: is vlc installed?
> dpkg -s vlc|grep installed
Here is some logic in bash script, like installing package if it is not there:
1
2
3
4
5
6
problem=$(dpkg -s vlc|grep installed)
 echo Checking for libxul: $problem
 if [ "" == "$problem" ]; then
      echo "No libxul. Setting up libxul"
      sudo apt-get --force-yes --yes install vlc
 fi

Thursday, 11 April 2013

How to Enable and Disable Root Login in Ubuntu 12.04 TLS

We have recently installed Ubuntu 12.10 Desktop and Ubuntu 12.10 Server, we have nowhere asked to supply root password during installation. Generally in Linux, root user does exist and we need to supply root password during installation. By default root account is disabled in Ubuntu Linux because of security reason and you cannot login as root user directly or su - (Switch User) to become a root. You need to add sudo (superuser do) before actual command if you want to run all administrative commands and you need to supply your password when prompts for password.


Sudo is allowed user to become superuser for temporary to run superuser administrative tasks.
During installation only allow to create new user which has no root ( aka super user) privileges. But same user is allowed to execute sudo commands. Configuring sudo access for users, need to configure /etc/sudoers.
We’ll be covering the usage of SUDO and also we are going to show you tips & tricks to become root user.

Tuesday, 17 July 2012

Some Websites not open in SQUID Proxy

Websites not accessible via Squid

Problem


Some websites not accessible through Squid.

Following message is noticed in the browser

The following error was encountered: 
  • Read Error
The system returned: 
    (104) Connection reset by peer

Environment

Squid 2.6.STABLE21-6 
Squid 3.1.10-1 

Resolution

Add the following to squid.conf  and restart squid service

via off
forwarded_for delete


Root Cause/Diagnostics

Site was accessible directly. Via squid, connection would reset abruptly

Only difference when accessed via squid and directly was the addition of

X-Forwarded-For and via headers in the HTTP request

X-Forwarded-for usually contains the IP address of the host that requested the website

Example:  
X-Forwarded-For: 192.168.0.1
VIA usually has information about the proxy server
 
Example:
via: example.com 

Documentation:  forwarded_for and via

By disabling via off and setting forwarded_for delete, we disabling these headers in the HTTP request.
Disabling this header should not have any negative impact.

-----------------------------------------------------------------------------------------------





Friday, 22 June 2012

Check Point : SecurePlatform (SPLAT) Backup Options Available.



One aspect of the Check Point SecurePlatform OS that I struggle to get my head around is backups. There are a few different options, and during the course of researching an upgrade I came across the best explanation I’ve seen yet.  I’ve decided to grab a copy of the relevant text and post it in my blog for future reference here.

Oversimplified Executive Summary

  • upgrade_export contains just Check Point configuration
  • A backup is an upgrade_export plus SPLAT OS configuration
  • A snapshot is a backup plus binary files, both Check Point and SPLAT OS
  • As a general rule of thumb, if your restoring on the same hardware a snapshot would be the easiest to use since it contains the most info and an upgrade_export would be the worst, since you’d have to manually restore the most stuff.

Checkpoint : Mount USB Memory Stick / Pen Drive to Splat

Ever wanted to use an USB stick on OpenServer using SPLAT or an appliance?

Just connect the device to an USB port of your choice.

1. Load the appropriate kernel module for handling the USB device.
* modprobe usb-storage

2. Check which new device was bound, for example "/dev/sda1".
* fdisk -l

3. Create a mount point.
* mkdir /mnt/usbdisk

4. Mount USB device.
* mount /dev/sdb1 /mnt/usbdisk

5. Use the device to transfer data as you like.   "[DATA Transafer]"

6. Unmount USB device.
* umount /mnt/usbdisk


Thursday, 21 June 2012

How Traceroute Command Works ??

                                   Traceroute

What is Traceroute?
It is an application layer implementation to find the hops when a packet traverses to a destination.

What are the Protocols Used in Traceroute?
Traceroute works with combination of both ICMP and UDP. It mainly relies on ICMP Time-to-Live Exceeded (Type 11).

Wednesday, 20 June 2012

DDNS - Dynamic Domain Name System | What is DDNS , DNS

DDNS - Dynamic Domain Name System
We Know All before sending anything to his mail server, he will read the database from the public server for the latest ip address of mail server and put it as destination address.. But twas a small problem, at times after fetching the latest public ip of mail server, ISP DHCP renews the IP lease of mail server, hence the message lost.

Again after some time I started thinking about a vpn connectivity from an office which doesn't have public address, so the idea of DDNS came,

Before explaining DDNS, I hope you all have a good idea about DNS, For those who dont know, DNS is the one to one mapping between name to ip address. But in DNS its will not get updated dynamically and it may take even more than 24 hrs to get updated in the root DNS servers. Here come DDNS.

Monday, 18 June 2012

Blue Coat ProxySG - CLI Commands


Here is a list of Blue Coat ProxySG CLI commands, that I have compiled from my studies, Blue Coat documents, and places around the web. This is by no means an exhaustive or comprehensive list, but is rather meant to be a command line KB of sorts - mainly for my quick reference. The list is split into standard and privileged mode commands. If the list proves useful to you, please feel free to share the link with others. Also, if you see any typo's with anything, feel free to let me know!

What Is SIC (Secure Internal Communication) in Checkpoint Firewall

SIC - Encryption, Authentication and Secure Channel

The following security measures are taken to ensure the safety of SIC:

Certificates for authentication.

Standards-based SSL for the creation of the secure channel.

3DES for encryption.


******************************************************************************************************
****************************************************************************************************** 

Thursday, 14 June 2012

Checkpoint : SPLAT - Disable CD/DVD Rom | Disable CD/DVD Rom From SPLAT (Checkpoint Secure-Platform)


How to disable the "CD/DVD ROM" from "CLI"


FW [Admin]# cd /lib/modules/2.6.18-92cp/kernel/drivers/cdrom

FW [Admin]# mv cdrom.ko cdrom.ko.orig

FW [Admin]# Reboot

or

FW [Admin]# modprobe -r sr_mod

******************************************************************************************************
****************************************************************************************************** 

Tuesday, 12 June 2012

Installation and Configuration of Linux DHCP Server




For a cable modem or a DSL connection, the service provider dynamically assigns the IP address to your PC. When you install a DSL or a home cable router between your home network and your modem, your PC will get its IP address from the home router during boot up. A Linux system can be set up as a DHCP server and used in place of the router.

Saturday, 9 June 2012

Configuring Linux Samba (SMB) - How to Setup Samba (Linux Windows File Sharing)

Resource sharing, like file systems and printers, in Microsoft Windows systems, is accomplished using a protocol called the Server Message Block or SMB. For working with such shared resources over a network consisting of Windows systems, an RHEL system must support SMB. The technology used for this is called SAMBA. This provides integration between the Windows and Linux systems. In addition, this is used to provide folder sharing between Linux systems. There are two parts to SAMBA, a Samba Server and a Samba Client.
When an RHEL system accesses resources on a Windows system, it does so using the Samba Client. An RHEL system, by default, has the Samba Client installed.

Thursday, 31 May 2012

Design Of A Default Redhat Server 6.2 As Honeypot | HoneyPot Methods


Introduction


The following paper is a description of how I have designed and implemented a honeypot system. The paper describes how the honeypot is used to capture data in layers using different techniques. The aim of the honeypot is to discover the techniques and tactics used by blackhats (hackers) to compromise computer systems. The methods used are similar to the methods used by the Honeynet Project.

Monday, 28 May 2012

RedHat / CentOS Install and Configure Cacti Network Graphing Tool



Cacti is a network graphing tool similar to MRTG. How do I install and configure common options to collect SNMP data and various other data (such as system load, network link status, hard disk space, logged in users etc) into an RRD?

Monday, 21 May 2012

Linux: Setup a transparent proxy with Squid in three easy steps


Setup Squid proxy as a transparent server with Squid and iptables.
Main benefit of setting transparent proxy is you do not have to setup up individual browsers to work with proxies.

Friday, 4 May 2012

Grub & Single user mode password Protected

Hi,
Today i am working on my pc and i thought if i set password for single user mode then any one can’t entered inside and change the root password.

Steps:

1.First open terminal.
2.if you are not login with root then login as a root.
Note:- take backup of your grub.conf file becuase if something goes wrong then you can recove it.