Thursday, 23 June 2011

Create FTP user account - vsFTPd

Step 1

Install the vsftpd FTP programme
#yum install vsftpd

Step 2


Add a new FTP user
# adduser -c 'FTP USER john' -m john

# passwd john



Step 3

Restart the vsFTPd programme
# service vsftpd restart

Step 4

chown the path to the ftp user john
# chown -R /path/to/dir john


Restrict and secure SSH shell access - Linux Administration


Step 1

Edit the ssh config files

# /etc/ssh/sshd_config

Change the following lines

#Port 22
#Protocol 2, 1
#ListenAddress 0.0.0.0

Step 2

For more security change the port number

Port 5678 (Any number in 1-5 digits, It should not conflict with gemneral ports. ex., 3306 is MySQL port)

Protocol 2

ListenAddress 64.18.127.85 (Your machine IP Address)

If you would like to disable direct Root Login, scroll down until you find

PermitRootLogin no

Step 3

Once file save restart SSHD service

# /etc/rc.d/init.d/sshd restart

Try your setting with a duplicate session to avoid access trap.

Saturday, 18 June 2011

Reset lost MySQL user password - Linux

Resetting your lost password on MySQL is quite easy.

Step 1
Stop your running server and start MySQL on safe mode

# mysqld_safe --skip-grant-tables &

Step 2

Now login as root, you don't need a password here;

# mysql -u root


Step 3

Change the password using the UPDATE query


# UPDATE mysql.user SET Password=PASSWORD('type-new-password') WHERE User='root';

Step 4

Flush the privileges to get things done


# FLUSH PRIVILEGES;

Friday, 17 June 2011

Installing CPANEL on your VPS or Dedicated Server

Make sure that your VPS server has enough resources to be able to run Cpanel. Minimum of 512 MB of memory to run Cpanel (1GB is recommended).

Before installing Cpanel, its good to setup a basic clean compile environment and get your server up to date with the latest patches and software updates.


# yum install selinux coreutils binutils make dialog gcc gcc-* glib*
# yum install libexi* libjpe* libpng* gifl* freetype curl curl-* xmlrpc
# yum upgrade kernel*
# yum update

Once you got the basics, time to install Cpanel/WHM:


# cd
# wget http://layer1.cpanel.net/cpanel-universal-install.sea
# chmod 700 ./cpanel-universal-install.sea
Test your installation by checking this URL;

http://xxx.xxx.xxx.xxx:2086/

Saturday, 11 June 2011

Change home directory of a linux user

Home directory of a user always reads like this, /home/username

Change it to your desired path using usermod.


usermod -d /path/to/new/homedir/ username

While creating a new user account on vsftpd, user will log in to their home directory. This shall help them to change the directory to the web root.

Friday, 3 June 2011

Install locate to AMI machines - Amazon EC2

AMI snapshot will not have locate command by default. Install them on your own.

[root@ip-10-194-11-42 ec2-user]# yum install mlocate
[root@ip-10-194-11-42 ec2-user]# updatedb

Here we go;

[root@ip-10-194-11-42 ec2-user]# locate httpd.conf
/etc/httpd/conf/httpd.conf
/etc/lighttpd/lighttpd.conf
/usr/share/doc/lighttpd-1.4.28/lighttpd.conf

Thursday, 2 June 2011

Security Group - Amazon EC2

Security Group plays an important role in setting the network security of your machine.

Keep an open access to following ports for a Development Webserver

80 (HTTP)
3306 (MySQL)
22 (SSH)
21 (FTP)
443 (HTTPS)

Below is an Quick Start security group setup