a blog about tech and geek stuff

Import/Export mysql file through ssh

Connect to server through ssh and type,

To Export,

mysqldump –opt -uusername -ppassword -h localhost dbname > backupfilename.sql

To Import,

mysql -u dbuser -p -h dbhost.yoursite.com dbname < /path/to/backup.sql

Zero byte file generate and upload using ncftp

When the only possibility of deleting a file in a remote host is to overwrite an existing file, we can generate a 0 byte file by the following way,

$> cat /dev/null > zero_byte.dat
$> ncftp -u host.server.com
$> put -z zero_byte.dat

Zimbra: Remove iSync from OSX

Type in a terminal window,
sudo /Library/PreferencePanes/Zimbra.prefPane/Contents/Resources/ZimbraHelper --uninstall

Zimbra CACert Install

Backup and Clean Current Certs
su - root
cd /opt/zimbra/ssl/zimbra/commercial/
tar -czvf /tmp/ssl.commercial.backup.tar.gz *
rm -rf *

Generate new csr (certificate request)
/opt/zimbra/bin/zmcertmgr createcsr comm -new

This uses the defaults, change according
/opt/zimbra/bin/zmcertmgr createcsr comm -new "/C=US/ST=TX/L=Somewhere/O=Company, Inc./OU=Department/CN=mail.domain.com"

Verify files presence,
ls -la

Should list,
commercial_ca.crt / commercial.csr / commercial.key

Cat the csr and submit to cacert.org,
cat /opt/zimbra/ssl/zimbra/commercial/commercial.csr


Paste the cert generated by cacert.org,
nano /opt/zimbra/ssl/zimbra/commercial/commercial.crt

Get cacert root.crt and class3.crt and cat both in one file
cat root.crt class3.crt > commercial_ca.crt

/opt/zimbra/bin/zmcertmgr verifycrt comm commercial.key ./commercial.crt ./commercial_ca.crt

If the output looks good, you can deploy the certificate via this command:

/opt/zimbra/bin/zmcertmgr deploycrt comm ./commercial.crt ./commercial_ca.crt

The final step would be to restart the zimbra services for the change to take effect.