Wednesday, March 28, 2012

sendmail attachment

echo 'abc.com DB backup' | nail -a ~/security/abc.mysql -s 'abc DB backup ' abc@gmail.com

Friday, March 16, 2012

Apache not parsing php page

1,
yum install httpd php

2, check if php.conf in the folder of httpd conf
/etc/httpd/conf.d/php.conf

3, restart httpd
service httpd restart

Thursday, March 15, 2012

`require': no such file to load

Error message:
[root@localhost restful]# ruby validedge.rb
validedge.rb:3:in `require': no such file to load -- rest_client (LoadError)
from validedge.rb:3

[root@localhost restful]# cat validedge.rb
#!/usr/bin/env ruby
require 'rest_client'

#require 'rest-client'

RestClient.get 'http://google.com/'

Solution:
Add require 'rubygems'
[root@localhost restful]# cat validedge.rb
#!/usr/bin/env ruby
require 'rubygems'

require 'rest_client'

#require 'rest-client'

RestClient.get 'http://google.com/'

Wednesday, March 7, 2012

ubuntu change host name

Add your name in this file and reboot the box
vim /etc/hostname

ubuntu install mail server and client

apt-get install postfix

apt-get install mutt

Internal Server Error - .htaccess ubuntu

need to enable rewrite mod

root@ssnew:/# a2enmod rewrite
Enabling module rewrite.
Run '/etc/init.d/apache2 restart' to activate new configuration!
root@ssnew:/# /etc/init.d/apache2 restart
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]

ubuntu install ghostscript jpgraph

root@ssnew:/home/cmmolc# apt-get install ghostscript

root@ssnew:/home/cmmolc# apt-get install libphp-jpgraph

disable root login via ssh - ubuntu

Change "PermitRootLogin yes" to "PermitRootLogin no"

root@li78:~# vim /etc/ssh/sshd_config

PermitRootLogin no

ubuntu 10 login warning banner

1, open file
root@li98:~# vim /etc/ssh/sshd_config
uncomment
Banner /etc/issue.net

2, Add your warnig to /etc/issue.net

3, restart ssh service
root@li78:~# service ssh restart

Tuesday, March 6, 2012

VirtualHosts not working - ubuntu

1, default file:

root@l78:/etc/apache2# less sites-available/default
NameVirtualHost 7.27.22.7:80

ServerAdmin gxxxng@gmail.com

DocumentRoot /var/www


Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all


ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined


2, your website
root@li94-78:/etc/apache2# less sites-available/3wtemplates.com


ServerAdmin gxxxxxxxxx@gmail.com

ServerName 3wtemplates.com
ServerAlias www.3wtemplates.com

DocumentRoot /var/www/3wtemplates.com/htdocs

NameVirtualHost *:80 has no VirtualHosts - ubuntu

comment out this line in

root@l948:/etc/apache2# vim ports.conf
#NameVirtualHost *:80

Friday, March 2, 2012

linux date command fields without zeros

With zero
root@li60:~/security# date --date "1 day ago" "+%b %d"
Mar 01

Without zero
root@li60:~/security# date --date "1 day ago" "+%b %-d"
Mar 1