Sunday, July 5, 2009

sshfs remote mount

sudo chmod og-rwx localFolder/
sudo sshfs user@remoteHost:remoteFolder/ localFolder/ -o allow_other

scp remote copy with port select

scp -P 22 sourceFile user@remoteHost:folder

Thursday, June 25, 2009

Excel export chart to jpg png

Hi,

Requires code. Syntax: Activechart.Export ,

You can use this in the immediate window,(ALT+F11 CTRL+G)

Activechart.export "C:\mychart.jpg"

Saturday, December 6, 2008

Mysql windows (xampp) case sensitive tables

Open file C:/xampp/mysql/bin/my.cnf and under [mysqld] add
lower_case_table_names=0

Thursday, November 27, 2008

Evince papersize

Add the a line with
LC_PAPER="en_HR@hrnum"
in
/etc/environment
Evince will use A4 as default paper format after your next login.

What is en_HR?

en_HR is locale meant to be used by computer users whose native language is Croatian, but who are primarily used to US English based interface. Therefore en_HR features US English messages, and US style of writing numbers. US numeric style is chosen because of the decimal separator - in US style the decimal separator is `.', which is commonly used in mathematics and by SI, while Croatian decimal separator is `,'. If you would rather use Croatian numeric style, then use en_HR@hrnum instead of en_HR. Collate, ctype, monetary, paper, telephone, measurement, name and adress settings are the same ones from hr_HR locale. Date and time format conforms to ISO 8601 standard.

Wednesday, November 12, 2008

ssh tunel from linux

ssh -L 8080:192.168.2.254:80 user@address.org -p 22



Open your browser and go to http://localhost:8080 to see if your tunnel is working.

ssh -L localport:host:hostport user@ssh_server -N

where:
-L - port forwarding parameters (see below)
localport - local port (chose a port that is not in use by other service)
host - server that has the port (hostport) that you want to forward
hostport - remote port
-N - do not execute a remote command, (you will not have the shell, see below)
user - user that have ssh access to the ssh server (computer)
ssh_server - the ssh server that will be used for forwarding/tunneling

Without the -N option you will have not only the forwardig port but also the remote
shell. Try with and without it to see the difference.

Note:
1. Privileged ports (localport lower then 1024) can only be forwarded by root.
2. In the ssh line you can use multiple -L like in the example...
3. Of course, you must have ssh user access on secure_computer and moreover
the secure computer must have access to host:hostport
4. Some ssh servers do not allow port forwarding (tunneling). See the sshd man
pages for more about port forwarding (the AllowTcpForwarding keyword is set to
NO in sshd_config file, by default is set to YES)...

Example:


ssh -L 8888:www.linuxhorizon.ro:80 user@computer -N
ssh -L 8888:www.linuxhorizon.ro:80 -L 110:mail.linuxhorizon.ro:110 \
25:mail.linuxhorizon.ro:25 user@computer -N


The second example (see above) show you how to setup your ssh tunnel for web, pop3
and smtp. It is useful to recive/send your e-mails when you don't have direct access
to the mail server.

For the ASCII art and lynx browser fans here is illustrated the first example:

+----------+<--port 22-->+----------+<--port 80-->o-----------+
|SSH Client|-------------|ssh_server|-------------| host |
+----------+ +----------+ o-----------+
localhost:8888 computer www.linuxhorizon.ro:80

...And finally:
Open your browser and go to http://localhost:8888 to see if your tunnel is working.

Wednesday, September 24, 2008

linux adduser bash batch script

#!/bin/bash

NEW_USERS="/path/to/file.txt" #space separated user password group
HOME_BASE="/home/"

cat ${NEW_USERS} | \
while read USER password GROUP
do
pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
useradd -g ${GROUP} -p ${pass} -m -d ${HOME_BASE}${USER} ${USER}
done