Thursday, October 3, 2013

Windows to Linux Storage Sharing: cifs mount params


Ever wonder on how to mount using mount.cifs.  This is dinosaur tech but I am putting it here anyway.

Act I.  Get and create your credentials file

Get the correct credentials from the shared drive and then do the following:


sudo echo -e "username=service" > /somedir/.somecredentials; sudo echo -e "password=p@ssw0rd" >> /somedir/.somecredentials


Act II.  Mount the drive

First create a mount point for this new share under your linux system.

mkdir /mnt/winshare

Then issue this command.

mount.cifs "//some_ip_address/mount_drive" /mnt/winshare -o credentials=/root/.somecredentials


Act III.  Bootstrap it!

The goal is for this service to available every time a reboot occurs, you can do this by creating a simple script to help on this on and put it on /etc/rc.local


Cheers!

Sunday, September 1, 2013

Unix Timestamp conversion (Convert Unix Time)

Have you ever had the chance to work on logs to investigate on a few items that needs immediate reports and judgement, while you are at it logs shows the standard "unix" convention.  To spare you all this hardship use the following formatting on every known log you have.

perl -p -e 's/^([0-9]*)/"[".localtime($1)."]"/e'

I does all the magic for you.

e.g.  tail -n 20000 /some_path_to_logs | (command above) | less

Cheers!!!


Server Hardware Memory Alignment

Have you ever had the chance of migrating old memory to a newer hardware, only to find out that its not reading all those modules when they should be?

The reason for this is that, server hardware is channel specific, what I meant by this is that if your board supports more than one processor slot and who have no luxury of reading the setup manual.  Chances are you are putting those memory modules on locations which they are not ought to be in.   The hint is this.  The closer the memory banks to a processor the most likely that that is the correct channel for those banks.

Try it. 


rsync to a different port

There are instances when you are faced with issues on securing your servers and in the process systematically closing all the default ports.  Real hassle if you do "rsync" on a regular basis.  Apparently, there is a simply solution for this.  All you need to do is train it to use a different port.

e.g.

rsync -av -e 'ssh -p 35500' /home/footloader fooflight01@server1.saltsugar.net 
** above will rsync home dir to a certain server


Awesome?  Cheers!!!

Thursday, August 15, 2013

ssh-copy-id -i on a different port

If it ever occurred to you that a changed has been done to your ssh config particularly the default port of 22 into something else.  Then you need to implement password-less ssh.  Then you got this:

ssh: connect to host 121.97.35.82 port 22: Connection refused

Solution:

ssh-copy-id -i  file_path "username@some_ipaddress -p port_number"

Cheers!

Monday, August 12, 2013

Secure Copy to a Different Port

At times you need to change the order in which services like ssh run on its default port for security reasons.  This in effect will impact your scp as well.  Here is the syntax for it.

$ scp -P port_number  /some_path_to_a_file @Ip_address

Cheers!

Sunday, August 11, 2013

Password Generator

If in any case you needed to create phrases of passwords.  This is the likely key:  http://goo.gl/aJD7Kv