Inorder to disable direct root login on a linux server, you need to do the following thing:
1. vi /etc/ssh/sshd_config in that file make
Permitrootlogin no then save it
2. Restart sshd service
/etc/init.d/sshd restart
3. Now create a new user and set password for that user.
4. Add that user to the wheel group
vi /etc/groups // add that user to the group of wheel
5. Now logon to the server using the username and password and then do
su - and provide the root password
Inorder to work this properly you should have the following permission settings
chmod 4755 /bin/su
chmod 1700 /etc/passwd
chmod 1700 /etc/shadow
chmod 1755 /etc/groups
If there is anything wrong with this permission, you may get permission denied or incorrect password errors.
Enjoy:)
Disabling direct root login
Posted by Mayur's BLOG 0 comments
RSYNC
Posted by Mayur's BLOG 0 comments
rsync utility is used for synchronising files one of the major adavantage of rsync is that rsync can preserve permissions and ownership information, copy symbolic links, and generally is designed to intelligently handle your files
The basic syntax for rsync is simple enough -- just run
rsync [options] source destination
If you want to rsync the contents from /home/mabin/ to /var/www/html/ the command
rsync -a /home/mabin /var/www/html
Whe doing rsync there is a big meaning in the ending '/' because if I rsync /home/mabin/ then only the contents inside the folder mabin will be copied.....but if didn't used the '/' ie /home/mabin then the entire directory will be taken ..that is a directory named mabin will be created at the destination
some switches with rsync
-----------------------------
-a --> archive option, which actually combines several rsync options. It combines the recursive and copy symlinks options, preserves group and owner, and generally makes rsync suitable for making archive copies. Note that it doesn't preserve hardlinks
-H --> Copies hard link
-v --> verbose mode
-z --> Compress option, will compress the data during transfer
--delete --> For deleting the already transferred data from source (a dangerous option, try to avoid it)
--exclude=".*/" --> To avoid copying hidden files. With this option you can avoid copying any particular file( If you dont want to copy .php files then pot it like this --exclude="*.php/"
sample command for local copying
----------------------------------------
rsync -avh /home/mabin/ /var/www/html
Rsync for remote copying
------------------------------------------------------------
rsync -avhe ssh /home/user/dir/ user@remote.host.com:dir/
If you want to know how fast the transfer is going use the --progress option
rsync --progress -avhe ssh /home/user/dir/ user@remote.host.com:dir/
Enjoy:)
Roundcube installation on cPanel server
Posted by Mayur's BLOG 0 comments
1-Login to the server as root and run the following:
cd /usr/local/cpanel/base
wget http://dfn.dl.sourceforge.net/sourceforge/roundcubemail/roundcubemail-0.1.1.tar.gz
tar -zxvf roundcubemail-0.1.1.tar.gz
rm -rf roundcubemail-0.1.1.tar.gz
mv -f roundcubemail-0.1.1 roundcube
chown root.root -R roundcube
cd roundcube
chmod -R 777 temp
chmod -R 777 logs
mysql -e “CREATE DATABASE roundcube;” -pDATABASEPASSWORD
mysql -e “use roundcube; source SQL/mysql.initial.sql;” -pDATABASEPASSWORD
cd config
mv db.inc.php.dist db.inc.php
mv main.inc.php.dist main.inc.php
Note:Replace DATABASEPASSWORD with your server MySQL root password
2-Open db.inc.php with Pico
pico db.inc.php
Find this line in the file using (Ctrl+w)
$rcmail_config['db_dsnw'] = ‘mysql://roundcube:pass@localhost/roundcubemail’;
Replace the line above with the following line:
$rcmail_config['db_dsnw'] = ‘mysql://root:DATABASEPASSWORD@localhost/roundcube’;
Note:Replace DATABASEPASSWORD with MySQL server root password
save and close.
3-Open main.inc.php with pico
pico main.inc.php
find the following lines in the file and edit their values as the following:
$rcmail_config['enable_caching'] = FALSE;
$rcmail_config['default_host'] = ‘localhost’;
$rcmail_config['enable_spellcheck'] = FALSE;
Save and close
4-There are some changes need to be done in index.php file, instead of telling you what to find, add or remove, I have made a ready to made index.php file for you to use and you are done.
You can get the index.php file by running the following command lines:
cd /usr/local/cpanel/base/roundcube
wget http://www.2mhostblog.com/rc.1.1.tar
rm -f index.php
tar -xf rc.1.1.tar
rm -f rc.1.1.tar
5-Finally, restart your cpanel service
service cpanel restartEnjoy:)
Installing Subversion Using yum on CentOS 5
Posted by Mayur's BLOG 0 comments
Is is very simple, you can install it by using yum. But I found most of the time it is not as simple as we assume.
While attempting to install Subversion via yum today, I received the following error:
[root@sXXX ~]# yum install subversion
Loading “installonlyn” plugin
Setting up Install Process
Setting up repositories
extras 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
bla..bla..:)
bla..:)
bla..:)
Error: Missing Dependency: perl(URI) >= 1.17 is needed by package subversion
Steps to resolve this:
#wget http://yum.trixbox.org/centos/5/RPMS/perl-URI-1.35-3.noarch.rpm
#rpm -i perl-URI-1.35-3.noarch.rpm
#yum install subversion
That's it.
Enjoy:)
How do I enable innoDB storage engine?
Posted by Mayur's BLOG 0 comments
You can enable InnoDB by accessing your server via SSH as root ( or another account then use su or sudo to gain root access). Once that is done, check /etc/my.cnd for an entry like:
skip-inndob
If such an entry exists, remove or comment out the entry and restart MySQL.
If such an entry does not exist, then there are other problems for which we will need more information.
Once InnoDB is enabled, you can make it the default table type by specifying the following in /etc/my.cnf:
default-table-type=innodb
Enjoy:)
Setup Your Nameservers on Directadmin
Posted by Mayur's BLOG 0 comments
To setup your nameservers, simply do the following:
- Login to your DirectAdmin panel as "admin"
- Go to your IP Management section, and add two new IP addresses
- Once they are added, click the check boxes next to the two IPs that you've just submitted. Assign these IPs to "admin"
- Now go to your Reseller panel, and navigate to your Nameserver section
- On this page, create your two nameservers, generally ns1. and ns2.
- Finally, go back to your Admin panel and go to your Administrator Settings page. Set your nameservers to the ones you have just created and save your changes.
Enjoy:)
Checking the configuration of named.conf and zone files
Posted by Mayur's BLOG 0 comments
It is sometimes easy to make changes in named.conf file or in any zone files manually though the control panel has options to modify them. If the changes are being made manually, we should also make sure that the configuration as well as the zone files are not being messed up.
The bind package has utilities to check the syntax of named.conf and any zone files. We can make use of those binaries to check our modifications done to those files before reloading or restarting named service.
To check the sytax of zone file /var/named/kb.com.db for the domain kb.com,
[root@bash ~]# named-checkzone kb.com /var/named/kb.com.db
zone kb.com/IN: loaded serial 2006032401
OK
[root@ bash~]#
If everything is correct, it will show the serial number with which the zone file is loaded. Otherwise, it will give error message indicating the line number at which the error occured.
To check the syntax of named.conf file,
[root@bash ~]# named-checkconf /etc/named.conf
[root@bash~]#
You may also load the configuration of all master zones listed in named.conf at the time of checking the syntax as,
[root@bash ~]# named-checkconf -z /etc/named.conf
zone localdomain/IN: loaded serial 42
zone localhost/IN: loaded serial 42
zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
zone 255.in-addr.arpa/IN: loaded serial 42
zone 0.in-addr.arpa/IN: loaded serial 42zone kb.com/IN: loaded serial 2006032401
[root@bash ~]#
The command will show a detailed output in case any error in named.conf file.
This way we can make sure that we are not editing the configuration file wrongly.
Enjoy:)