Leave a comment

Steps to Install and Configure VSFTP Linux

Please refer the step by step VSFTP instllation and configuration instrucations below For more detail regarding the vsftpd conf file you can check it here :

$ sudo yum install vsftpd
Type “y” to continue to install VSFTP and “n” to cancel the instillation.

Note: Backup before doing any changes:

$sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.original
$ sudo vi /etc/vsftpd/vsftpd.conf

⦁ anonymous_enable=NO
⦁ local_enable=YES
⦁ chroot_local_user=YES
⦁ write_enable=YES
⦁ allow_writeable_chroot=YES
⦁ pasv_enable=YES
⦁ pasv_min_port=1024
⦁ pasv_max_port=1048
⦁ pasv_address=52.63.170.185
⦁ xferlog_std_format=NO
⦁ log_ftp_protocol=YES
⦁ local_root=/var/www/html
⦁ listen=NO

$ sudo /etc/init.d/vsftpd restart

To Allow Port for VSFT externally from your AWS EC2 Instances: Log in to the AWS EC2 Management Console ==> Security Groups from the navigation tree on the left. Select the Security Group assigned for you EC2 instance. and Click on Inbound tab, click Edit:

inbound-rule

To Allow VSFTP From Firewall:

$ vi /etc/sysconfig/iptables

-A INPUT -m state –state NEW -m tcp -p tcp –dport 20:21 -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 1024:1048 -j ACCEPT

$ sudo ufw allow ftp
$ sudo service iptables restart or $sudo service firewalld restart

Create FTP User and Add it to a Group:

$ sudo useradd testuser
$ sudo groupadd sftponly
$ useradd test user -g sftponly -s /bin/false
$ sudo passwd testuser
… Password.. 4dt…….10
sudo usermod -a -G apache testuser

Set write access for VSFTP User and Block shell access:

 

sudo usermod -d /var/www/html/userdir

sudo chmod 775 /var/www/html/userdir

sudo chown testuser:testuser /var/www/html/userdir

sudo mkdir -p /var/www/html/userdir

sudo find /var/www/html -type d -exec chmod 777 {} \;

sudo usermod -s /bin/false testuser

Manager Service to start on Reboot:

$ sudo chkconfig –level 345 vsftpd on
$ sudo ntsysv

inbound-rule

You can also Control Bandwidth by editing :

$ sudo cp /etc/vsftpd.conf
anon_max_rate=30000
local_max_rate=300..
max_per_ip=5
local_max_rate=300..

Configure SSL with vsftpd: 

To secure vsftp its batter idea to secure your website, you can create ssl certificate and secure your code.

$sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/myfile.pem

$ sudo vi /etc/vsftpd/vsftpd.conf

rsa_cert_file=/etc/ssl/private/myfile.pem
ssl_enable=YES
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH

Once the config file entry done please don’t forget restart the service.

$ sudo service vsftpd restart

FTP Testing and FTP Client Tools:

WinSCP : http://winscp.net/
Filezilla: http://filezilla-project.org/

VSFTP Errors And Troubleshooting:

To check which port being use with FTP Server:
$ netstat -tulpn | grep :21
You will see output like below:
(No info could be read for “-p”: geteuid()=500 but you should be root.)
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN –

VSFTPD, 553 Could not create file.
Response: 553 Could not create file.
Error: Critical file transfer error
Solutions: $chown -R ftpusername /var/www/html

 

Leave a comment

Disable SSH root Login |Disable Direct Root Login Linux

To Allow Root Login remotely is a big risk for your server and it can be hacked.

For security reason it is recommenced to disable root login. you can follow below steps to disable root login.

You can create a user different with root access and disable root login for externally.

$ adduser mynewuser
$ passwd mynewuser (generate strong password)

To Assign Root priviliages to your user:

$ visudo
$ mynewuser ALL=(ALL) ALL

Login into your server with root login and manually edit /etc/ssh/sshd_config and change PermitRootLogin to “no

$ /etc/ssh/sshd_config

See uncommitted line below:

#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

Then restart SSH in by typing

$ service sshd restart
Stopping sshd: [ OK ]
Starting sshd: [ OK ]

Now verify it again

$ ssh myipaddress or mydomain.com -l root

IT should give you output like:

Permission denied, please try again… 

 

Leave a comment

To find number of CPU Cores and Virtual Cores Linux / Windows

To check or count number of CPU you can get output by executing below commands on Linux Terminal:

To Count number of CPUs: 

cat /proc/cpuinfo | grep processor

Output :

2

To check the number of cores !
cat /proc/cpuinfo | grep 'core id'
core id         : 0
core id         : 1

$lscpu
Architecture:          i686
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                2
On-line CPU(s) list:   0,1
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             1
Vendor ID:             GenuineIntel
CPU family:            15
Model:                 4
Stepping:              7
CPU MHz:               2792.992
BogoMIPS:              5585.98
L1d cache:             16K
L2 cache:              1024K
OR
grep -Pc '^processor\t' /proc/cpuinfo


For Windows Users Use CPU-Z

http://www.cpuid.com/softwares/cpu-z.html

Or

Open Command Prompt and run:

WMIC CPU Get DeviceID,NumberOfCores,NumberOfLogicalProcessors

CPU-check

Open Command Prompt and run:
WMIC CPU Get /Format:List

Example Output:
AddressWidth=32
Architecture=9
Availability=3
Caption=x64 Family 6 Model 69 Stepping 1
CpuStatus=1
CreationClassName=Win32_Processor
CurrentClockSpeed=1701
CurrentVoltage=12
DataWidth=64
Description=x64 Family 6 Model 69 Stepping 1
DeviceID=CPU0
ExtClock=100
Family=11
L2CacheSize=512
L3CacheSize=2048
L3CacheSpeed=0
Level=6
LoadPercentage=3
Manufacturer=GenuineIntel
MaxClockSpeed=1701
Name=Intel(R) Pentium(R) 3558U @ 1.70GHz
NumberOfCores=2
NumberOfLogicalProcessors=2……..

Ctrl + Shift + Esc To  open the Windows Task Manager ==> Performance  Now see boxes in the CPU Usage History section which will show how many cores you have. It has hyper threaded cores also.

Example windows:

CPU-check

 

 

 

Leave a comment

AWS Code Commit Steps For Linux Users

Login into your AWS Console :

https://console.aws.amazon.com

  • Go to Amazon Web Services ==> Amazon Web Services ==> and Click on Code Commit:

Create new repository:

  • On Dashboard of Code Commit Click on “Create new repository” they Type the “Repository name” and Description of Repository  in the Description field. Next Create Repository
  • Click on Repository and it will show 2 urls for cloning:

ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/Repository_Name

https://git-codecommit.us-east-1.amazonaws.com/v1/repos/Repository_Name

Create IAM User (Identity & Access Management):

  • Go to Amazon Web Services ==> Security & Identity and Click on
Identity & Access Management:
  • From the  “IAM Resources” Click on “Users” select the user if it is now create you can create it From “Create User
  •  Enter User Names: Selcet check box “Generate an access key for each user” and then Create user.
  •  Selcet User: Go to Permissions Tab ==>  Managed Policies ==> Attach Policy
  • From drop down list or in search bar select Policy  “AWSCodeCommitFullAccess”. and Click on Attach Policy:
  •  Next go to “Security Credentials” ==> SSH keys for AWS CodeCommit Section lick on “Upload SSH Public Key”
  • Create Key Follow the steps below for Linux Users:

cd $HOME/.ssh
ssh-keygen  // type the name for rsa key file and keep default all option
Copy  my_aws_codecommit_rsa.pub file code from $cat my_aws_codecommit_rsa.pub to IAM
User “Upload SSH Public Key” Section. and it looks like below

  iamupload
  • Next on your System create a file named “config” by typing cd $HOME/.ssh $ touch config

$ chmod 600 config
$ vi config

  • Enter the following value in Config file Host git-codecommit.*.amazonaws.com User [YOUR_SSH_KEY_ID_FROM_IAM] IdentityFile ~/.ssh/codecommit_rsa
    Verify by typing $ssh git-codecommit.us-east-1.amazonaws.com
    Successful Message: You have successfully authenticated over
    SSH. You can use Git to interact with AWS CodeCommit.

    • Now Git clone your Create Code Commit Repository to your desired path:

$ cd /var/www/html/ $ git clone ssh://git-codecommit.us-east-1.amazonaws.com/v1/ repos/Repository_Name Message: warning: You appear to have cloned an empty repository. Checking connectivity… done.
  • Put your code into the Repository and type $ git status # to check its status $ git add //your code files or directory
    git config --global user.name "Your Name"
    git config --global user.email you@example.com

$ git commit $ git push. Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 622 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: To ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/ MyGitRepository  * [new branch]      master -> master

 

Now Check your AWS Console Code Commit Repository it should be updated with latest Code you have committed:
Thanks !!

Leave a comment

Steps to Install Linux, Apache, MySQL, PHP (LAMP) on Ubuntu

This guide provide detailed information about LAMP  known as opensource software’s (Linux Apache MySQL and PHP.

1. Check Host name by executing:   # to check host name of your system and fqdn:
$ hostname
$ hostname -f
2. first update ubuntu by executing below commands for latest releases and updates:
$ sudo apt-get update
$ sudo apt-get upgrade

3. Install MySQL:

$ sudo apt-get install mysql-server
During the installation it will promt for a password for the MySQL root user please type your password.

4.  Secure MySQL Installations by following the steps test uses and databases etc.

$ sudo mysql_secure_installation

5. Root Login:

mysql -u root -p

or

mysql -h localhost -u root -p
create database render_web;
create user ‘render_web’@’localhost’ identified by ‘mypassword’;

For Exetnal Access:

create user ‘render_web’@’remote-ip’ identified by ‘mypassword’;

grant all on render_web.* to ‘render_web’;