Setting up Virtual user with VSFTPD with Different Permissions

If you want to  setup a virtual user with  VSFTPD and also want to  share the same directory across multiple users then you can refer the below simple steps to achieve this :

  • Install VSFTPD  server
yum install vsftpd
  • Open the /etc/vsftpd/vsftpd.conf file and add the below contents :

save and quit

Here pasv_address= is explicitly used to map the nat IP  to  public IP for passive port

  • Now go  to  directory /etc/vsftpd/vsftpd-virtual-user/ and create the file :: vsftpd_user
    cd /etc/vsftpd/vsftpd-virtual-user/

    Note :: You need to  create the directory : /etc/vsftpd/vsftpd-virtual-user/ if it doesn’t exist

  • In vsftpd_user file add the usernames for which you want to set per user  configuration
[email protected]~[#] cat vsftpd_user
  • Now create the usernames file as ::
[email protected]~[#] cat test

Here, deny_file will limit the access to specific files and folders for user test and same will be used for hiding the files

To use the benefit of share/common directory add the users as ::

First create a group called :  ftp_users

then add the users as ::

useradd -d /home/share-drive -s /sbin/nologin username

Once done that, use the command usermod -G ftp_users test this will facilitates all the files and folders creation with test:ftp_users .

To  add new user use :
 useradd -d /home/share-drive -s /sbin/nologin -g  ftp-users test1

Finally,  restart the VSFTPD service and you are done.


all FTP commands and save it on the system for reference:

# List of FTP commands
# ABOR - Abort an active file transfer.
# ACCT - Account information.
# ADAT - Authentication/Security Data (RFC 2228)
# ALLO - Allocate sufficient disk space to receive a file.
# APPE - Append.
# AUTH - Authentication/Security Mechanism (RFC 2228)
# CCC  - Clear Command Channel (RFC 2228)
# CDUP - Change to Parent Directory.
# CONF - Confidentiality Protection Command (RFC 697)
# CWD  - Change working directory.
# DELE - Delete file.
# ENC  - Privacy Protected Channel (RFC 2228)
# EPRT - Specifies an extended address and port to which the server should connect. (RFC 2428)
# EPSV - Enter extended passive mode. (RFC 2428)
# FEAT - Get the feature list implemented by the server. (RFC 2389)
# HELP - Returns usage documentation on a command if specified, else a general help document is returned.
# LAND - Language Negotiation (RFC 2640)
# LIST - Returns information of a file or directory if specified, else information of the current working directory is returned.
# LPRT - Specifies a long address and port to which the server should connect. (RFC 1639)
# LPSV - Enter long passive mode. (RFC 1639)
# MDTM - Return the last-modified time of a specified file. (RFC 3659)
# MIC  - Integrity Protected Command (RFC 2228)
# MKD  - Make directory.
# MLST - Lists the contents of a directory if a directory is named. (RFC 3659)
# MODE - Sets the transfer mode (Stream, Block, or Compressed).
# NLST - Returns a list of file names in a specified directory.
# NOOP - No operation (dummy packet; used mostly on keepalives).
# OPTS - Select options for a feature. (RFC 2389)
# PASS - Authentication password.
# PASV - Enter passive mode.
# PBSZ - Protection Buffer Size (RFC 2228)
# PORT - Specifies an address and port to which the server should connect.
# PWD  - Print working directory. Returns the current directory of the host.
# QUIT - Disconnect.
# REIN - Re initializes the connection.
# REST - Restart transfer from the specified point.
# RETR - Retrieve (download) a remote file.
# RMD  - Remove a directory.
# RNFR - Rename from.
# RNTO - Rename to.
# SITE - Sends site specific commands to remote server.
# SIZE - Return the size of a file. (RFC 3659)
# SMNT - Mount file structure.
# STAT - Returns the current status.
# STOR - Store (upload) a file.
# STOU - Store file uniquely.
# STRU - Set file transfer structure.
# SYST - Return system type.
# TYPE - Sets the transfer mode (ASCII/Binary).
# USER - Authentication username.

Encrypting MySQLDump

If  you are looking to Encrypt your MySQL database dump for security reasons than you can  use the ccrypt tool  to encrypt your dump.sql file.

Follow the below simple steps to  achieve the database dump encryption and decryption :

  1. Create a  encryption key file as /root/.backup_keyfile and add the password/key in  that file
  2. This keyfile  will be used to  encrypt and decrypt the data [dump.sql file]

Now,  that we have created the encryption  file we just need to  execute the below commands :

      mysqldump --opt  opsview |  ccrypt  -k /root/.encryptkeyfile > opsview.sql


This will encrypt the opsview.sql file and to  decrypt the opsview.sql file use :

[[email protected] ~]# cat opsview.sql | ccrypt -d -k /root/.backup_keyfile > opsview1.sql


This will  decrypt the opsview.sql file, easy  isn’t it 😀



CVE-2014-7169 BASH Shell Shock Vulnerability for Linux & How to fix

I guess by now we all heard about Bash Shell shock vulnerability and how dangerous it could be .

What is CVE-2014-7169 / Shell Shock Vulnerability?

GNU Bash through 4.3 bash43-025 processes trailing strings after certain malformed function definitions in the values of environment variables, which allows remote attackers to write to files or possibly have unknown other impact via a crafted environment, as demonstrated by vectors involving the ForceCommand feature in OpenSSH sshd, the mod_cgi and mod_cgid modules in the Apache HTTP Server, scripts executed by unspecified DHCP clients, and other situations in which setting the environment occurs across a privilege boundary from Bash execution.

NOTE: this vulnerability exists because of an incomplete fix for CVE-2014-6271.

In short Shell Shock vulnerability allows remote attackers to execute arbitrary code given certain conditions, by passing strings of code following environment variable assignments.

The Shell Shock vulnerability  is considered  bigger  than Heartbleed as it’s affecting all  versions of bash  and it’s still unclear from  when and adding to that linux bash is not only running on linux webservers  but other embedded devices as well such as Mac Laptops .


Am I Affected ? 

To test,  if your version of Bash is vulnerable to this , run the below command ::

[email protected][#]  env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
bash: warning: x: ignoring function definition attempt
bash: error importing function definition for`x'
this is a test

If you get the above output then you are safe.

But,  if you get the below output then you are affected

[email protected][#]  env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
this is a test

How to fix ?

For RedHat/CentOS/Fedora/RPM based OS:
Note:: This is a temporary fix released by Red Hat Security Team. The team is still working on a full fix which is expected to release soon.
[email protected][#] yum upgrade bash
APT-GET: Ubuntu / Debian
sudo apt-get update && sudo apt-get install --only-upgrade bash
External References:

That’s all.