Monday, 15 June 2015

How to create FTP for aws without directory Listing

 
Step 1
 
1 - apt-get install vsftpd
2 - vim /etc/vsftpd.conf
3 - changes
 
listen=YES

anonymous_enable=NO

local_enable=YES

write_enable=YES

dirmessage_enable=YES

use_localtime=YES

xferlog_enable=YES

connect_from_port_20=YES

chroot_local_user=YES ( First One )

secure_chroot_dir=/var/run/vsftpd/empty

pam_service_name=vsftpd

rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem

rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

pasv_enable=YES
port_enable=YES
pasv_min_port=1024 pasv_max_port=1048 pasv_address=0.0.0.0 

Note - 0.0.0.0 will be your be your public IP



Step 2
Add Port in your Security Group
tcp 20-21
tcp 1024-1048



Step 3 echo 'allow_writeable_chroot=YES' >> /etc/vsftpd.conf

Done

Wednesday, 10 June 2015

How to setup mongodb replSet

Master IP - 172.31.9.122
Replset IP - 172-31-17-152


Step 1 - Install mongoDB

# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

# echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

# sudo apt-get update

# sudo apt-get install -y mongodb-org


Step 2 - vim /etc/mongod.conf

Change
Bind Ip - 172-31-9-122 (your IP)
Replsetname - harish (Your Replset Name)


Note - Be Carefull and change according.

Step 3 - Login into mongo

mongo --host 172.31.9.122

>

rs.initiate(
{_id: "harish",
  members: [
    {
      _id: 1,
      host: "ip-172-31-9-122.ap-southeast-1.compute.internal",
      arbiterOnly: false,
      buildIndexes: true,
      priority: 1
    }
  ]
}
)

Step 4 - Install MongoDB with step 1

Step 5 -  vim /etc/mongod.conf

Change
Bind Ip - 172-31-17-152 (your IP)
Replsetname - harish (Your Replset Name)

Step 6 - Add you replset
Login to you master mongo
mongo --host 172.31.9.122
>
 rs.add('ip-172-31-17-152.ap-southeast-1.compute.internal:27017')


Note -
service mongod start
service mongod stop
service mongod status

If not running then go /var/lib/mongod/mongo.lock and delete mongo.lock file then start you mongod