Thursday 23 June 2016

550 CHMOD 666 *.php: Operation not permitted - proftpd

ProFTPd version 1.34 - Giving write permission to certain folder /directory in Linux centos 6.7


Issue : Allow write access to one user and Deny for all.

<Directory /var/www/uploads/*>
<Limit WRITE>
DenyAll
AllowUser FtpUserName
</Limit>
<Limit SITE_CHMOD>
DenyAll
AllowUser FtpUserName
</Limit>
</Directory>


If we do not define DenyAll and Deny ftpusername it will throw the error like

550 CHMOD 666 *.php: Operation not permitted if file permission is tried to change
or
Critical file transfer error  if file upload or transfer is initiated

Note : Deny Clause need to define else setting is not work (I do not find this on google but change only reflect once i added DENY)

Monday 20 June 2016

AWS CLI in Cent OS 6.7 with Python 2.6.6 , Python 2.7 not required for aws cli

After searching in AWS doc it says upgrade your python to 2.7 before installing aws.

However we are stuck with centos 6.7 and if we upgrade to newer version it might impact other area of our application.

So we tried to install it without upgrading

Below are the commands to install aws cli without 2.7 python as root login


  • cd /opt
  • curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
  • unzip awscli-bundle.zip  
  • sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
  • aws --version
version output

aws-cli/1.10.38 Python/2.6.6 Linux/2.6.32-573.22.1.el6.centos.plus.x86_64 botocore/1.4.28


Saturday 18 June 2016

Httpd apache Server-status via location match

Httpd Server-status via location match not working in Centos or Ubuntu 

For Server Monitoring Apache Server-status is very useful thing

However there are situation due to rewrite rules location match for Apache is not triggers or not working correctly

Spot the problem 

Confirm that in httpd.conf 

mod_status.so  should not be commented

Incorrect
#LoadModule status_module modules/mod_status.so

Correct (remove the # to uncomment)
LoadModule status_module modules/mod_status.so

If its already un-commented then check your rewrite rule if they overriding the location setting ?

How to check : You can check by simply http://yourip/server-status if it not display some stat regarding Apache and redirect to your website then rewrite rules are overriding 


Solution ?

Update your location path in your conf it might be httpd.conf or any other location
Note : This can be placed in last line of the conf file out of any <VirtualHost></VirtualHost> tags

<Location "/server-status.monitor">
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from <your pubic ip>
</Location>

Find the section where css,js and images are excluded from rewrite rule this rule can be found in httpd.cof or  .htaccess of your website

RewriteCond %{REQUEST_URI} !^(.*).(css|js|gif|png|jpg|jpeg|swf|monitor)$

Add |monitor in the end

Restart the httpd 

Now try http://yourip/server-status.monitor