Tuesday, June 23, 2015

How to add user in Centos 6

Hello again, today i want to share about how to manage user in Centos 6 64Bit. User are an account that has created by user or by 3rd Party Application in order to run.

User can be created if you want to add another account to share your VPS, but remember, because you are in one VPS, so you much share your resource too  with another user that logon in your VPS.

You can limit user activity too for your user, example, if you want to limit your user only using SSH, or FTP, or VPN, it’s up to you. I recomend to limit your user, so it can be controlled, and your VPS not too overload, because some VPS Host will suspend VPS if there are unusual activity or high activity that makes VPS Overload.


1. How to add user in Centos 6
adduser angelimus
passwd angelimus

then type your password twice

2. How to add user in Centos to Group
usermod -a -G ftp angelimus

-a = append user in group
-G = new list of supplementary GROUPS
ftp = group name

another example :

usermod -a -G ftp angelimus, porthos, socrates, delinios

3. How to limit user in centos 6
- Prevent User using SSH and FTP
usermod -s /sbin/nologin mynewssh 
- User only using VPN
vi /etc/ppp/chap-secrets
angelimusVPN pptpd pass900 *



4. How to lock user in centos 6
usermod -L angelimus

5. How to remove user in centos 6
userdel angelimus
just delete user account

userdel -r angelimus
-r = remove angelimus home directory too

6. How to force expired user password in Centos 6
chage -d 0 angelimus

7. How to view user password in Centos 6
cat /etc/passwd

Monday, June 22, 2015

How to Create Strong Password and Easy To Remember

A password is a word or string of characters used for user authentication to prove identity or access approval to gain access to a resource (example: an access code is a type of password), which should be kept secret from those not allowed access.
definition of Password by wikipedia.com

Create some password is a common things that people do, most of all online service, asking their user to register using username or email, after that you must create your password, then, you can using their service, it easy right?

But HOW IF, someone using your ID to use your paying service? Maybe no problem for you, but HOW IF someone login to your account and doing some illegal activity on the internet??? That's will be a HUGE problem for you, i guarantee.

You think you Password can't be breach? Because you use password generator?
Hmm... how about if you have 10 diffrent account in diffrent website, are you using diffrent password for each account, and you generate your password using password generator, do you remember it all? If yes, how about 50 diffrent account? do you remember it all??? :P no offense.

Do you believe you can remember all username and password of 1000 diffrent account and website?
  - Yes, i can remember it all.


Okay, i will show you some sample to create strong password using some pattern, with your brain as password generator.

Step 1 - Find something you like but no one knows, only you and god knows it, or maybe you can select it randomly, but you must remember, it's like your secret word.
Example : i choose word "BASH" because i create script using BASH everyday.
avoid your dog name, mother name, father name, chidren name, because name is easy to guess

Step 2 - Create Pattern,  create some custom pattern that originally from your mind, dont use the hard one, create the simple one, and remember it.
Example : [type connection] - [website/application] - [secret word] - [amount of character in website]

Example i want create account in https://www.facebook.com/

type connectionfor website i use HT from Http:// , for application i use AP from App , for ftp i use FT from ftp:// , for ssh i use SS from ssh:// ,  for sftp i use SF from sftp://.
Now we have 5 diffrent combination

website/applicationname of website that we will use to register, in this case is facebook i only take the last two word which is ok from facebook so i use "Ok"

secret word : which is "BASH"

amount of character in website : facebook contain 8 character, so i use 8.

Final, so my password for http://www.facebook.com is

HTOk"BASH"8

Simple right? how about http://www.yahoo.com

HTOo"BASH"5

Take more example on application like game, it need 2 password, web password and game password, and in some games required vault password.
Example game Perfect World, website http://www.arcgames.com/en/games/pwi

Password for Website
HTEs"BASH"8

Password for Game
APEs"BASH"8

That's all, all you need to remember is your pattern and your secret code, simple right, how about that 1000 account? can you remember all?? YES...

But, is it still can be breach?? Yes... using Dictionary Brute Force, but maybe it takes about 2 years or more, its not worth it to breach it. 

With only 2 thing which is BASH and Pattern, you have qualified password. Your password can't be breach by anyone, except by you, so don't ever tell your PATTERN or Secret Code to anyone or anything that looks like human, except your pet :P, and don't ever write it down or save it in your computer, even its your personal computer. 

Our brain is most strong and secure password generator.

Saturday, June 20, 2015

How to Unzip / Zip file in Centos 6

Hello again, now i want to share how to zip and unzip file in centos, what in zip file? zipping file is collecting a few or more file that you choose and compress it into one file, so you can give that file or send to your friend or send it to file hosting, zip file usually used when you want to backup something, as a sample, i have website that i put on /public_html folder, and i want to back it up in case something happened or maybe you want to do a major change to your website, so i just zip my /public_html directory into one file, and i start change or modify the original file, if something happened, i just recover all my files in /public_html directory by unzipping from zip file that i created as backup.

Before we start, make sure zip package is installed in your system, by type zip in your terminal.
zip

if there are no zip package installed, it will reply -bash: zip: command not found
so you must install it first by type :

yum -y install zip

1. Zip
Now you have zip package installed in your system, now type zip, there are a lot of option for zip, we don't use that all, i usually only use -r and -v.
-r is recurse into directories it means, zip include directory
-v is verbose it will showing line by line what file has been added to your zip file

the command fo zip is

zip [options] [new_file_name.zip] [dir / file(s) that we want to zip]

example :
i want to zip files with .txt as extension
zip -v /home/backup/backup_mytext.zip /home/tutorial/*.txt

i want to backup my website file in /html/wordpress into /home/backup/
cd /var/www/html/wordpress/
zip -rv /home/backup/backup_myweb_15062015.zip *

2. Unzip
Before using unzip, try type
unzip

if the reply is -bash: unzip: command not found it mean there are no unzip package in your system, so you must install it first by type
yum -y install unzip

Now unzip package already installed in your system, lets start
To view file in .zip, use this command
unzip -l /home/backup/backup_myweb_15062015.zip

To restore / extract zip file, use this command
unzip /home/backup/backup_myweb_15062015.zip -d /var/www/home/html/wordpress

To restore / extract zip file, and overwrite it
unzip -o /home/backup/backup_myweb_15062015.zip -d /var/www/home/html/wordpress

To restore / extract zip file, and update it
unzip -u /home/backup/backup_myweb_15062015.zip -d /var/www/home/html/wordpress

There are a lot of options to use, but not all of that options is used, it depends on your case, maybe you will use it, but these are a basic command in compress and extract file(s)

Wednesday, June 17, 2015

How To Monitoring Running Process in Centos 6 64Bit

Hello, again now i want to share some tutorial about how to monitoring resource on centos 6, this tutorial is very common, i got this from a few source, a few of them i got from tecmint.com, you can check it there for more information and of course there are much usefull information, you must visit there.

What is monitoring running process?? in windows, we usually use task manager to see what is running on our system, but in centos, we have a few similar tool like task manager too, but if you only use terminal there are a few script or command to show what running on your system.

Sometimes we got our VPS running slow, and you must check on control panel in website for how much our memory is being used or how high our processor load, it not necessary, it wasting time of course, cause centos has built in tools to check memory usage and processor usage to, and the important things is we must know, if is there any other user using our VPS or no, because sometimes we dont know who are using our VPS, and what is application that our user running.

1. Some cool stuff from Tecmint.com  (Post by AVISHEK KUMAR)
This stuff has great view, i like this too, and sometimes i used it too, it has many information about our VPS, to install it, follow this step, open your terminal, and type :
Dependency
There is no dependency required to use this package for a standard Linux Distribution. Moreover the script don’t requires root permission for execution purpose. However if you want to Install it, you need to enter root password once. (original statement from tecmint.com)


Security
Have taken care to ensure security of the system. Nothing additional package is required/installed. No root access required to run. Moreover code has been released under Apache 2.0 License, that means you are free to edit, modify and re-distribute by keeping Tecmint copyright. (original statement from tecmint.com)


wget http://tecmint.com/wp-content/scripts/tecmint_monitor.sh


chmod 755 tecmint_monitor.sh./tecmint_monitor.sh -i


monitor


2. Top (Built-in centos 6 monitor)
If you need more spesific about what is PID of running process, the user who running the application, how many resource used by application, etc you just type :
top

3. ps -eLf
To use this, you don't need to install anything, just type it, this will show you history of running process by user and also what command that user type to run script, use this if you have unknown user in your system.
ps -elf


4. atop
This is similar like top, but you must install first. Open your terminal and type :
yum -y install atop
to run it just type atop.



5. htop
This is similar like top and atop, but this more colorful and has built in function to kill process, search, filter, and the important is this application can modify priority of running process, you can modify it in realtime, no need to kill the process first. Use up and down arrow to select process and select what task todo.
yum -y install htop
to run it just type htop.



Thats all, you decide which one you want to use, remember, all application above running consume resource too, dont you run all time, use it when you need it.

Friday, June 12, 2015

How To Create Sub-Domain in Virtualmin

Hello again, now i'm gonna show you how to "Create Sub-Domain in Virtualmin" in this tutorial i will install roundcube and add sub-domain pointing to roundcube. Roundcube is a web-based email client. In previous post, i have explain how to create sub-server in Virtualmin (How To Create Sub-Server Virtualmin), Sub-Domain and Sub-Server are diffrent, and the way to create it is diffrent.


Before we want to create Sub-Domain or Sub-Server, we must know what is the diffrent, how do they act, and the structure in directory.
Let's take an example : forum.angelimusvps.tk, let see the structure both Sub-Domain and Sub-Server, see below.

Sub-Server directory of forum.angelimusvps.tk
/root/home/angelimusvps.tk/domains/forum.angelimusvps.tk/public_html/<website files>

Sub-Domain directory of forum.angelimusvps.tk
/root/home/angelimusvps.tk/public_html/forum/<website files>

Okay, lets start create Sub-Domain.

Step 1 - Install Roundcube 
(you can skip this step if you already have directory for sub-domain destination directory)
1. Open your browser, and login to your terminal.
2. Choose your domain that you want to install roundcube on left panel, by click the drop down menu.
3. Click Install Script on left panel, and see on the right panel, in email section, click on roundcube
4. Click on Play Button on the Right or Simple Just Click "Show Install Options"
5. I'm gonna use my domain in this case angelimusvps.com, so my "Database for RoundCube preferences" = angelimusvps_tk_roundcube (MySQL, new database)
6. Install sub-directory under public_html = DO NOT CHOOSE at top level, and type roundcube, by default its checked beside that.
7. Click "Install Now"

Note :
(1)For someone of you that running Centos 6, maybe have a little problem in PHP Version, in my case, i can't install roundcube, because my PHP Version is 5.3.3 so i must upgrade into PHP 5.4.x, see this tutorial to upgrade your php How To Upgrade PHP 5.3 to 5.4 in Centos 6

(2)After installing roundcube, now try open your browser and type http://<yourdomain>/roundcube if nothing  happened, or it's like downloading or saving something else, maybe thats normal, because i have same problem like that before, now go to virtualmin again, on left panel > angelimusvps.tk (as domain) > Server Configuration > Website Option > PHP script execution mode = Apache mod_php (run as Apache's user) 

Click save, now try again open your roundcube http://<yourdomain>/roundcube

Step 2 - Create Sub-Domain 
Now i'm gonna make subdomain inbox.angelimusvps.tk that point to /home/angelimusvps.tk/public_html/roundcube

1. Manage your domain in your domain provider.
My domain is free domain from freenom.com, so i login to freenom.com and manage  freenom domain, add new record inbox A (your ip) see image below
after that click on save changes, wait about 10-30 minutes, i usually only wait about 10 minutes.
to check if it already registered, try ping inbox.<yourdomain>.tk if no reply or time out, wait again a few minutes and ping again. If you still confuse about this manage dns, see my previous tutorial in ()

2. Go to Virtualmin, on left panel, on top section, click on Webmin
3. Click Servers > Apache Webserver, now see on right panel, click on "Create Virtual Host

1. Choose "Spesific address" = your vps ip address
2. "Document Root" = find your directory that you want to redirect to subdomain.
3. "Server Name" = just type your subdomain, i type inbox.angelimusvps.tk
Click "Create Now"

Note : after you click create now, see on top right section, Click "Apply Changes", then "Stop Apache", then "Start Apache"

Open your browser, and type your subdomain, ex : http://inbox.angelimusvps.tk you will see your sub directory redirected to sub-domain.

I think that's it for now, if your have a better and simple and more secure, feel free to share on comment section, and see you in next tutorial.

Thursday, June 11, 2015

How To Upgrade PHP 5.3 to 5.4 in Centos 6

Hello again, now i want to share about how to change PHP Version, in Centos 6, many of them are still running PHP 5.3.3, actually there are nothing to worry about PHP 5.3.3 but in some case, you need to run on PHP 5.4.x


Step 1 - Checking Version of PHP
Okay, now lets start.
Before we upgrade make sure you running PHP 5.3.x, how to to that?
Open your terminal and type
php --version


See picture above, it showing the version of PHP that running in your system


Step 2 - Upgrading PHP 5.3.x into PHP 5.4.x
Now we will upgrade it into 5.4.x
Type command below in your terminal
wget https://raw.githubusercontent.com/zaq111/bash/master/angelimus-upgrade-php-53-54.sh
chmod +x angelimus-upgrade-php-53-54.sh && ./angelimus-upgrade-php-53-54.sh

after this, there are a few prompt, just answer with typing "y" (without quote)
when its all done, just type
php --version

to re-check that your PHP version is already upgraded.


It's done.
See you in next tutorial.

How To Create an Email Account for Virtualmin

Email is the most important things in your personal or bussiness website, email is one of the media to communicate between admin and user of website, beside social media. Its nice if you have email with your own name and your own domain, it can boost your popularity of your website too, for me i prefer emailing rather than calling or pm in social media, because i have high intense in checking my email, but remember, emailing can consume more resource to your VPS, in some VPS Host, there are some restriction about mass mailing, it is a feature to mailing all your costumer or all your friend or all people that you dont know for reason is promoting your website or something that you thinks it is necessary, 

Now we will begin to create email user in Virtualmin, i assume you already create website in virtualmin, if not, see previous tutorial ( >> How to Create website in Virtualmin)

Step 1. Accessing Virtualmin
Open your browser and login to your virtualmin by entering
Https://<your domain or VPS IP Address>:10000



I using domain from freenom.com as i mention in previous tutorial (How To Create Sub-Server in Virtualmin) which is angelimusvps.tk

Step 2. Creating and Cofiguring User in Virtualmin
1. Click on edit user on the left panel (see pic below)


2. Click on Add a user to this server (see pic below)

see in the list, there are already angelimusvps.tk,
that user is by default create when we create virtual server in earlier tutorial about 

3. See picture below
1. Email Address : this is email address username (ex: admin, or support, or yourname, etc)
2. Real Name : Type your Real Name or anything you like.

3. Password : create the password for your username (password will be used in here >> (


Mail Forwarding Setting
4. Tick "Yes, forward to address" and type the destination email, if you want to forward automatically your email from this account to another email account.
5. Tick "Yes, repond with message", if you this, when your user or friend sending you an email, there will be an automatically reply email to sender.
ex: "A" sending an email from angel@yahoo.com to your email admin@angelimusvps.tk, after "A" sending an email, he/she will automatically get a reply from admin@angelimusvps.tk.
This feature usually contain a greetings or welcome message, etc. Just type a good sentence here if you want to enable this feature.
6. Minimum time between autoreplies, for security reason i recomend you to DO NOT Choose "No Minimum", because if someone do an email bomber to your email account, it cause a heavy duty to your VPS it will result you get banned by your host. Just select about 5 or 7 minute for safety.

7. Click Create, to create your email user.

It's done, see you in next tutorial about virtualmin.

Wednesday, June 10, 2015

How To Create Sub-Server Virtualmin

Hello again, in previous Tutorial Topic about How To Create Multiple Website on Virtualmin, now i want to share How To Create Sub-Server on Virtualmin using Centos 6 64Bit.
In this tutorial i still use VPS from Evoburst.com, the reason is, Evoburst.com provide high resource with low end price.


Step 1 - Manage Domain and Add Sub-Domain in DNS Management
- Login to freenom.com
- Click on Domains > My Domains      (see pic below)


- Click on Manage on Domain you create in previous tutorial before (Tutorial host multiple website using Virtualmin)  (see pic below)


- Click on Manage Freenom DNS
-

- Add your subdomain name (in this tutorial i using forum as subdomain), Type = A, Target = <vps ip address> (see pic below)
- Click on Save Changes


- Now wait about 5-10 minutes, while trying this
- Open terminal and type this code
host forum.angelimusvps.tk ns01.freenom.com

Note change forum.angelimusvps.tk to <your-sub-domain>.<domain>.tk.co
- if the result is forum.angelimus.tk has address 104.xxx.xxx.x9
- it means your subdomain is registered.


Step 2 - Creating Sub-Server on Virtualmin
- Now go To Virtualmin (see pic below)

- Then Click on Sub-Server
- Domain Name = <your-sub-domain>.<domain>.tk.co      ex: forum.angelimusvps.tk

- Click on create server, now open the browser, and type <your-sub-domain>.<domain>.tk.co      ex: forum.angelimusvps.tk

- If you got error like this
- It means your subdomain is ready to use.
- Open terminal, and type
cd /home/angelimusvps.tk/domains/forum.angelimusvps.tk/public_html
echo "This test sub-server - angelimus.blogspot.com" >> index.html

- Now your browser again and refrsh, like picture above. (see pic above)
Thanks for reading my tutorial, supported by freenom.com and evoburst.com

Tuesday, June 9, 2015

Tutorial host multiple website using Virtualmin

Now, i want to share my experienced in hosting multiple websites on your VPS that running Centos 6 64 Bit, using Virtualmin as web management. In previous tutorial, i have share how to install wordpress in VPS, and if you follow my tutorial from beginning (all tutorial are in this blog, just visit angelimus.blogspot.com) i have install many packages to my VPS and NOT Using Fresh Install to Install Virtualmin, so there are a few thing can cause trouble in future, but it's not a big deal, i believe that every problem has a way out.
Since installing Virtualmin, i use VPS from Evoburst.com, cause it have more than enough RAM and CPU Resource.


Now, after through the "boring part" (Tutorial Post-Installation Wizard Virtualmin) but maybe the important ones.

If in your VPS you install SSH Dropbear (Part 5 - Installing SSH Dropbear on Centos 6 64Bit), then you must follow this tutorial from Step 1, if you not installing SSH Dropbear, just skip this step, and go to Step 2

Step 1 : Solving conflict on Port 443 between SSH and SSL
Open your terminal
sed -i 's/OPTIONS="-p 443"/OPTIONS="-p 444"/g' /etc/init.d/dropbear
Now your port for SSH Dropbear is "444", conflict solved.

Step 2 : Register free domain at freenom.com
(If you already have registed domain you want to use, like mynewvps.com or mywebhost.com, etc, the point is it registered and still active, then you can skip this Step, go to Step 3)

  1. Open your browser, and go to http://www.frenom.com (why freenom? because it free, no cost at all, and this is for testing purpose).
  2. Find domain you like, then click check availability, choose from the list thats free, (see pic below)
  3. Click Checkout
  4. Click USE DNS, in type your VPS ip address there, type the same ip addpress on both. (see picture below)
  5. Click continue, and follow the instruction until finish.

Step 3 : Host Multiple Website
Open your browser, and go to Virtualmin by type
https://<vps ip address>:10000/
1. Login with username = root and password = (your root password)
2. i assume you already done step (Tutorial Post-Installation Wizard Virtualmin)
3. See on left panel, Click on Create Virtual Server (see image below)



4. After click it, see on right panel
Domain name (from freenom.com) = angelimusvps.tk
Description = (type anything you like, eq web1, etc)
Administration password = (type anything you like, eq passweb1, etc)
Administration username = Choose Custom Username and write (from freenom) angelimusvps.tk

Custom username is directory name where your public_html or your directory for website files.
eg: if you type angelimusvps on Custom username, and then in number 7 below, it must be

cd /home/angelimusvps/public_html/

I highly recomended that you using Custom Username same as your Domain name for beginning, so it will not confuse you in the future.


5. Open your browser, try input your domain from freenom (my domain is angelimusvps.tk)

6. It show Forbidden, because there are no website file
7. Now Open your terminal, type
cd /home/angelimusvps.tk/public_html/
echo "This is My First Website using Virtualmin - angelimus.blogpsot.com" >> index.html
Note : change angelimusvps.tk with your created domain

8. Try open your browser again, and type your domain
9. Now you're done,
10. To Create Multiple website, just go to Step 1
when you get stuck into trouble, just take a rest a while... because in the same time, you already resolve it without knowing it

Tutorial Post-Installation Wizard Virtualmin

Now we will configure Post-Installation of Virtualmin, there was a simple wizard provided by Virtualmin to setting Virtualmin based on your VPS resource.


Let's start Post-Installation Wizard
I assume, you already done installing Virtualmin ()
Open your browser.
https://<vps ip address>:10000/
you will see like this (see pic below)

Click Next
Memory Use
1. Preload Virtualmin libraries?
- if your VPS have low resource of memory and you have low frequency of visiting Virtualmin, Disable this option, but if you have more RAM, Enable this.
- Even you Disable this option, Virtualmin UI run stable.

2. Run email domain lookup server?
- if you have high activity in emailing, enable this.
- but if you have less memory, disable this, your email processing is bit slower.

Virus Scanning
Run ClamAV server scanner?
- if your server have high intense of receiving email, you better enable this option, because it lower your CPU Usage but consuming more memory (100Mb), so if you think your server will have activity in emailing, its better to rent vps with high ram
- if your server have low frequency of emailing, disable this.
Spam filteringRun SpamAssassin server filter?
- If your system is going to host domains that will receive a large amount of email, filtering incoming messages for spam can generate significant CPU load. This is due to CPU use by the SpamAssassin mail filter when it is started, so its better you enable this, because its only consume 30Mb,

Database Servers
1. Run MySQL database server
2. Run PostgreSQL database server
- If your server only run email server or DNS hosting, you not need both option above, but if you want to host website on your VPS, i recomend enable MySQL database server, its has more compatible with application nowadays.
Note : if you see >> MySQL has been enabled, but cannot be used by Virtualmin. Use the MySQL Database module to fix the problem.
It means you have not entering the mysql password, just click next, and you'll be asked for MySQL username and password. (check previous tutorial about mysql).
After that the wizard will ask if you want to change the password.

MySQL database sizeMySQL can be configured to trade off memory use for performance, depending on how much RAM your system has and how heavily you expect the database to be used.
The option is clearly explained about how often your mysql is used. If you not sure, just choose leave defaul settings

DNZ Zone
For this, just type server1.angelimus.com or serv1.example.com, etc, ant tick "Skip check for resolvability". I'll explain this in later tutorial.

Password
For this, read the explanation carefully, for me, i choose Store Plain text Password, but i strongly recomended you using Only Stored Hashed Password i'll create this tutorial later.

All Done. Click Next