Showing posts with label Linux Admin. Show all posts
Showing posts with label Linux Admin. 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?

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”.

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.

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