Categories

Friday 27 July 2012

How to mount sshfs remote directory in fstab

Hello,

 Sshfs is used to mount  a remote directory on another server to our local server.This can be done by installing the sshfs package and a package named fuse.

The mounting is done as below.
sshfs USERNAME@HOSTNAME_OR_IP:/PATH LOCAL_MOUNT_POINT SSH_OPTIONS
 
Eg: sshfs sessy@mycomputer:/home/sessy /mnt/sessy -C -p 9876
 
To unmount the remote system: 
fusermount -u LOCAL_MOUNT_POINT
 
To mount it again 
fusermount -u LOCAL_MOUNT_POINT
 
We have to do ssh-keygen inorder to avoid asking the password upon mounting.
 
This can be done as below.
Create private and public keys using ssh-keygen commands
 
ssh-keygen
 
This will generate  private key in /root/.ssh/id_rsa and public key in /root/.ssh/id_rsa.pub
Then copy the content in id_rsa.pub to users /.ssh/authorized_keys file in remote server from which we are mounting.
 
 
You can use scp to copy the file.
 
then try to connect it using   sshuser2remotehost ,this time password will not be asked.
 
Then mount is on fstab using the following settings
sshfs REMOTEUSER@REMOTE:REMOTEMOUNTPOINT LOCALMOUNTPOINT -pREMOTEPORTNUMBER -o uid=LOCALUSERID -o gid=DESIREDGROUPID -o idmap=user -o IdentityFile=/root/.ssh/YOURKEYFILE -o allow_other
 
Eg:sshfs#user@remote.com:/home/user/audio /var/www/html/audio 
fuse 
IdentityFile=/root/.ssh/id_rsa,idmap=user,allow_other,port=10022,uid=0,gid=0,rw,nosuid,nodev
  0 0  
 
 
Please see the link 
http://ewald.tienkamp.nl/2010/01/19/mounting-a-remote-file-system-over-ssh-using-sshfs-and-non-standard-settings/
 for more details.
Regards
 


Wednesday 25 July 2012

Temp directory hardening

Hello,

 Not all file systems are working inside a container; check /proc/filesystems inside a container to find 
out.
follow the steps given in http://linux-bloggers.blogspot.in/2012/06/hardening-linux-server-or-cenos-562.html in temp directory hardening section

mount -t tmpfs -o noexec,nosuid tmpfs /tmp

on /etc/fstab
/usr/tmpMnt /tmp    tmpfs   noexec,nosuid 0 0

Tuesday 24 July 2012

Images not loading issue on wordpress site

Hello,

 Images may not load on wordpress site if the permission of files are incorrect.To understand the file permissions of the wordpress contents,Please refer the link http://wordcastnet.com/2011/managing-file-permissions-in-wordpress/.

Wednesday 18 July 2012

How to change default mpm module of apache in Centos

In the RedHat-based Linux distributions, Apache webserver is configured to run with the prefork module by default; however, you can switch it to "worker" if you decide that this would suit your needs better. Usually, it is sufficient to uncomment this directive in the /etc/sysconfig/httpd file:
# grep HTTPD= /etc/sysconfig/httpd
#HTTPD=/usr/sbin/httpd.worker
and restart Apache
/etc/init.d/httpd restart

Please refer the link 
http://kb.parallels.com/en/113007 for furtherinformation.

Tuesday 17 July 2012

phpinfo page not working

Solution:

1)Copy /usr/local/cpanel/cgi-sys/php5.cgi to /home/username/ public_html/cgi-bin

2)Add the below given script

root [/home/username/public_html/cgi-bin]# vi phpini.cgi
#!/bin/sh
export PHPRC=/home/username/public_html
exec /home/username/public_html/cgi-bin/php5.cgi

3)And added a php.ini in the location (/home/username/public_html)

4)In the .htaccess put the following.

AddHandler php-cgi .php
Action php-cgi /cgi-bin/phpini.cgi

5) Permission of phpini.cgi should be 755


6) Now check the PHP page in your browser.

How to get plesk account information using mysql

1. Getting all the domain account information from Plesk
------------------------------------------------------------------------

mysql -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -e "select
login,password,home from sys_users INNER JOIN accounts on
accounts.id=sys_users.account_id;"

2. Get client login details from Plesk.
-----------------------------------------------

mysql -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -e "select
login,password from clients INNER JOIN accounts on
accounts.id=clients.account_id;"

3. Getting all mail account login information
--------------------------------------------------------

mysql -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -e "SELECT
CONCAT_WS('@',mail.mail_name,domains.name) as email ,accounts.password
FROM domains,mail,accounts WHERE domains.id=mail.dom_id AND
accounts.id=mail.account_id ORDER BY domains.name ASC,mail.mail_name ASC;"

4. Creating/deleting/updating mail accounts using command line
---------------------------------------------------------------------------------

create mail account

/usr/local/psa/bin/mail -c USER@DOMAIN.COM -passwd PASSWORD -mailbox
true -cp-access true

update mail account

/usr/local/psa/bin/mail -u USER@DOMAIN.COM -passwd NEWPASS

remove mail account

/usr/local/psa/bin/mail --remove USER@DOMAIN.COM

5. Mailing list management
----------------------------------

creating mailing list

/usr/local/psa/bin/maillist --create MYLIST -domain DOMAIN.COM
-passwd_type plain -passwd PASS -notify false -email LISTADMIN@DOMAIN.COM

Adding/removing members to the mailing list.

/usr/local/psa/bin/maillist -u MYLIST -domain DOMAIN.COM -members
add:NEW@DOMAIN.COM

/usr/local/psa/bin/maillist -u MYLIST -domain DOMAIN.COM -members
del:NEW@DOMAIN.COM

Getting list members

/usr/local/psa/bin/maillist -i MYLIST -domain DOMAIN.COM

Removing list

/usr/local/psa/bin/maillist -r MYLIST -domain DOMAIN.COM

6. Managing databases.
------------------------------

create database

/usr/local/psa/bin/database --create DBNAME -domain DOMAIN.COM -server
localhost:3306 -add_user DBUSER -passwd PASS

remove database

/usr/local/psa/bin/database -r DBNAMe

Sunday 8 July 2012

How to change admin login details of light speed webserver


Hello,
Light speed webserver user details can be changed by using a script /usr/local/lsws/admin/misc/admpass.sh.

Light speed server port number is 7080.So can acces the login page via http://servernae:7080.

Ad