More Technical Help

Showing posts with label Server Tweaks. Show all posts
Showing posts with label Server Tweaks. Show all posts

Sunday, May 8, 2011

Track Top memory and CPU consuming process


Use below mentioned command to get top memory consuming processes"

ps aux | head -1;ps aux --no-headers| sort -rn +3 | head

Use below command to get top cpu consuming processes:

ps aux | head -1;ps aux --no-headers | sort -rn +2 |more

Sunday, March 6, 2011

How to Change SSH port on cPanel Server

As far as security concern its a good deal to change the SSH port of your server, simply you need to follow the steps:

1) SSH to the server with root login

2) You need to make sure that the port you are going to assgin is opened at firwall (in case of CSF, APF):

CSF :
#pico /etc/csf/csf.conf

search for the line : TCP_IN

add the port

APF:
#pico /etc/apf/apf.conf

search for the line : TCP_IN

add the port
3) Now save the changes .

4) You need to change the ssh port in sshd_config File

# pico /etc/ssh/sshd_config
search for Port 22

Uncommnet the line and replace the port and save the file

5) Now it needs to restart ssh service

#/etc/init.d/sshd restart

Note :  Dont close your current ssh seesion until you confirm that you are able to login to the server wtih new port in another ssh session.


Thast's

Saturday, March 5, 2011

How to disable root login on cPanel server

For security purpose you may disable direct root login and create another ssh user with the privileges, simply you need to follow the steps:

Note : Don't close your current session until you confirm that the with the changes you have made, the server is accessible in another ssh session

1) Create a user say : webadmin

# useradd webadmin

2 ) Set password for webadmin

# passwd webadmin

3) In case of cPanel, you need to add this user to  'wheel group'

WHM >> Security Center >> “Manage Wheel Group Users”

Now the user has been granted su previlages, you need to disable the root login for that you will need to login to the server at shell (command prompt)

1) Edit the SSHD configuration file ‘sshd_config’:

pico /etc/ssh/sshd_config


2) Search the line

PermitRootLogin yes
and change it to
PermitRootLogin no


Once you are complete with the above changes, save the file and exit. You will have to restart the sshd service for the changes to take effect.

# /etc/init.d/sshd restart



Now, you will have to SSH to your server as user ‘webadmin’ and then su to root as follows:

login as: webadmin
webadmin@xx.xx.xx.xx’s password: <webadmin pass here>
[admin@server ~]$ su -
password: <root password here>
[root@server ~]#



Thats't