All posts by Pramod T P

SFTP User Creation CentOs

Step 1. Crate Group
groupadd sftponly

Step 2. Create user account
useradd -d /home/sftp/MYUSER -s /bin/false -G sftponly MYUSER

Step 3. Create a password for your username.
passwd MYUSER

Step 4. Ensure the following line is commented out in your sshd configuration file ( File Location: /etc/ssh/sshd_config )
# Edit the sshd_config file which holds the SSH/SFTP configuration
vi /etc/ssh/sshd_config
# Ensure this below Line has a hash symbol, # in front of it
#Subsystem sftp /usr/lib/openssh/sftp-server
# Ensure that this below line is added directly below the line you just commented out with a hash symbol #
Subsystem sftp internal-sftp

Step 5. Add the following to the bottom of the same file (it must be at the very bottom)
Match Group sftponly
ChrootDirectory %h
X11Forwarding no
AllowTCPForwarding no
ForceCommand internal-sftp

Step 6. Test the changes with sshd before restarting the service, please note it’s important you do this correctly, or may break your sshd configuration
sshd -t
service sshd restart

Step 7. Give proper ownership to the newly created folder
chown root:root /home/sftp/MYUSER

Step 8. Test SFTP credential is working:
# Connect to SFTP using the myuser, replace myuser with the user you’ve chosen
sftp myuser@localhost
myuser@localhost’s password:


MySQL Cursor

A cursor can’t be used by itself in MySQL. It is an essential component in stored procedures. I would be inclined to treat a cursor as a “pointer” in C/C++, or an iterator in PHP’s foreach statement.

With cursors, we can traverse a dataset and manipulate each record to accomplish certain tasks. When such an operation on a record can also be done in the PHP layer, it saves data transfer amounts as we can just return the processed aggregation/statistical result back to the PHP layer (thus eliminating the select – foreach – manipulation process at the client side).

Since a cursor is implemented in a stored procedure, it has all the benefits (and limitations) of an SP (access control, pre-compiled, hard to debug, etc).

MySQL supports cursors inside stored programs. The syntax is as in embedded SQL. Cursors have these properties:

Asensitive: The server may or may not make a copy of its result table

Read only: Not updatable

Nonscrollable: Can be traversed only in one direction and cannot skip rows

Cursor declarations must appear before handler declarations and after variable and condition declarations.


Magento Composer

We use Composer for dependency management. Composer enables us to manage the Magento components and their dependencies.
As an integrator, you want to manage each of your Magento core components and third-party components using the Component Manager and System Upgrade.
To do so, you start by creating a Composer project from our metapackage. The metapackage installs each component so it can be centrally managed after installation.

Composer provides you with the following advantages:

Enables you to reuse third-party libraries without bundling them with source code
Component-based architecture with robust dependency management
Manages dependencies to reduce extension conflicts and compatibility issues
Versioned dependencies
Semantic versioning
Supports the PHP Framework Interoperability standard