Wednesday, March 16, 2011

Enable Quota on RHEL/CentOS

Quota is used for limiting the disk usage for users or groups.

###To verify that the quota is enabled in the kernel###
#grep CONFIG_QUOTA /boot/config-`uname -r`
CONFIG_QUOTA=y
CONFIG_QUOTA_NETLINK_INTERFACE=y
# CONFIG_QUOTA_DEBUG is not set
CONFIG_QUOTA_TREE=y
CONFIG_QUOTACTL=y
[root@rajat rajat]#

Create user :
#useradd rajat
#passwd latar


Edit /etc/fstab :
From :
/dev/sda5 /home ext3 defaults 1 2
To :
/dev/sda5 /home ext3 defaults,usrquota,grpquota 1 2


Remount the disk (make sure it’s not in use) :
#mount -o remount /home

Check if usrquota and grpquota are enabled :
#mount | grep /home

Create quota files :
#quotacheck -cvug /home

This creates /home/aquota.user and /home/aquota.group

Check quota :
#quotacheck -avug

Enable quota for user1 :

#edquota user1
Edit soft and hard limits (1000 = 1 MB) or inode values.

Check the quota for user1 :
#quota user1

Enable quota :
#quotaon -avug

In addition :

Through a cron, run everynight when the filesystem is not used :
#quotaoff -avug && quotacheck -avug && quotaon --avug

Get quota stats :
#repquota -a

Wednesday, March 9, 2011

Install your own Video chat room CentOS AMIs

wget http://download.camfrog.com/get.php?type=fasl

[root@rajat ]# yum localinstall camfrogserver-5.0-4.noarch.rpm --nogpgcheck
Loaded plugins: langpacks, presto, refresh-packagekit
Adding en_US to language list
Setting up Local Package Process
Examining camfrogserver-5.0-4.noarch.
rpm: camfrogserver-5.0-4.noarch
Marking camfrogserver-5.0-4.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package camfrogserver.noarch 0:5.0-4 set to be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch       Version     Repository                       Size
================================================================================
Installing:
 camfrogserver     noarch     5.0-4       /camfrogserver-5.0-4.noarch     3.8 M

Transaction Summary
================================================================================
Install       1 Package(s)

Total size: 3.8 M
Installed size: 3.8 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : camfrogserver-5.0-4.noarch                               1/1
Certificate generated successfully, cert file name: /etc/camfrogserver.d/cert.pem, configuration file /etc/camfrogserver.d/cf_server.conf updated

***

Thank you for installing Camfrog Advanced Server for Linux.

Before you start Camfrog Server for the first time you must agree to the Camfrog Terms Of Service (TOS) and EULA at /etc/camfrogserver.d/CamfrogTOS.txt.
The TOS may be updated.  Please visit http://www.camfrog.com/terms.phtml for the most current TOS.
If you disagree with the Camfrog EULA or Terms of Service do not start Camfrog Server and uninstall it immediately.

***

The default config file is located in /etc/camfrogserver.d/cf_server.conf.sample

For the /etc/rc.d/init.d/camfrogserver startup script configuration settings please check /etc/sysconfig/camfrogserver.

Use the "service camfrogserver start" command to start server.


Installed:
  camfrogserver.noarch 0:5.0-4                                                 

Complete!
[root@rajat ]# cd /etc/camfrogserver.d
#cp cf_server.conf.sample cf_server.conf
#vi cf_server.conf
SSL_certificate_param=SiChE8xIyj3coZIATfXvf
# Enable remote access protocol. You can control your server using Windows-base$
remote_control_enabled=on
# Username/password for remote console access (full server management)
remote_control_login=rajat
remote_control_password=rajat

Port to open at AWS Management Console
6000:6010 tcp
5000:15000 udp
6005 udp
5999 tcp

[root@rajat camfrogserver.d]# service camfrogserver restart
Shutting down Camfrog server:                              [  OK  ]
Starting up Camfrog server daemon:                         [  OK  ]
[root@rajat camfrogserver.d]#

Now download Camfrog Advanced Server to your PC, and  Install it

Open Camfrog Advanced Server > Server Options > Change Server :)



Wednesday, February 16, 2011

Swap file in RedHat /CentOS /Fedora

$ dd if=/dev/zero of=/swapfile0 bs=1024 count=524288

Setup the swap area on the file you created.

$ mkswap /swapfile0

Enable the file for swapping

$ swapon /swapfile0

Permanently enable the swap file on boot.
Add the following lines to /etc/fstab.

/swapfile0 swap swap defaults 0 0
          

Check that the swap file is working the the free command. Also,
reboot too to make sure the swap file works on restart and that
/etc/fstab was correctly configured.

Disable SSH root login


Here is the step by step procedure to disable/deny direct root login via SSH

1. Login to the server as Root
2. Edit /etc/ssh/sshd_config

    Look for the line,

  PermitRootLogin=Yes
 
and then change the value of it to,

  PermitRootLogin=No 

3. Restart the sshd service and make sure its turned on
    service sshd restart        or     /etc/init.d/sshd restart
   
    service sshd status