Saturday, April 13, 2013

Recover /etc/passwd file in Linux


/etc/passwd is deleted accidently, Recover the file.

There is a backup file of /etc/passwd in same directory with name passwd-
$ sudo cp /etc/passwd- /etc/passwd $ sudo chmod 644 /etc/passwd

Lock the file using
$ sudo pwck -q

If you are not root user and do not use sudo before pwck -q, it will give error
pwck: cannot lock /etc/passwd; try again later.


External USB Hard Disk (HDD) NTFS not detected in CentOS

External (USB) hard disk is not detected :

Install NTFS package in centOS


$ yum install fuse fuse-ntfs-3g

If it does not work, download rpm file and install using
ftp://ftp.muug.mb.ca/mirror/fedora/epel/6/x86_64/ntfs-3g-2011.4.12-5.el6.x86_64.rpm


$ rpm -i filename

Change htdocs path in XAMPP

Here in this example, I am showing you to change the php project directories path from /opt/lampp/htdocs to /var/www

1) Open file /opt/lampp/etc/httpd.conf and change following line

DocumentRoot "/opt/lampp/htdocs"
to
DocumentRoot "/var/www"

2) Now search following line in same file (/opt/lampp/etc/httpd.conf)
and change

# This should be changed to whatever you set DocumentRoot to.
<Directory "/opt/lampp/htdocs">

to
# This should be changed to whatever you set DocumentRoot to. <Directory "/var/www">
(Above line is commented, it has been mentioned to find directive easily)

3) Restart the XAMPP.

4) If virtual hosts have been defined, change the path in /opt/lampp/etc/extra/httpd-vhosts.conf too.
Otherwise above steps will not work.

or if you want to remove virtual hosts, just comment following line in /opt/lampp/etc/httpd.conf
# Include etc/extra/httpd-vhosts.conf
5) Restart the XAMPP.

6) After following above process, if it throws php code in browser.
Uncomment following line in the file /opt/lampp/etc/httpd.conf
Include etc/extra/httpd-xampp.conf
This line should not be commented. It means there should be no Hash '#' symbol at start of the line.

7) If it gives Internal Server Error or Server Error.
Comment following line in the file /opt/lampp/etc/httpd.conf
# Include etc/extra/httpd-vhosts.conf
& Restart the XAMPP.