header image
Home
About Us
Events
Forums
How To Support Us
Products & Services
Projects
Supporters
Don's Blog
Farm Yard Scripts
Samba over SSH
Shopping

Notice: A session had already been started - ignoring session_start() in /var/www/sites/bowenvale/tcn.bowenvale.co.nz/subdomains/www/html/administrator/components/com_virtuemart/classes/ps_session.php on line 64
Wireless Networking Open Source Products Services Skype Products

List All Products


Advanced Search
Show Cart
Your Cart is currently empty.
Home arrow Linux Bits and Bobs
Linux Bits and Bobs
This section is a collection of useful Linux stuff that we've picked up along the way.


How to Set the Linux Prompt PDF Print

Enviornmnet variable PS1 is the prompt.

 To view the current setting use echo:

bash-3.1$ echo $PS1
\s-\v\$

To change the current setting use export:

bash-3.1$ export PS1="Don"
Don

 /bowenvale.co.nz/subdomains/wwwexport PS1="\w#"

\u - user

\h - name of host

\w - name of present working folder

.bashrc - to set your default

cut - to  

 

How to Count Files in a folder PDF Print

# ls | wc -l

 or

# echo * | wc -w


Echo is a built in command in Linux. 

wc - word count

-l - Count the lines

-w count the words

 When using echo * the result comes out as a single line with file names, so we need to use the -w option of wc.

When using ls the result comes out as a series of lines, one line per file, so we need to use the -l.

This makes some assumptions about the default configuration of ls.

 

How I Setup Samba SSH Tunnel PDF Print

The mission:  I want to be able to access files on the cia.crra.org.nz machine from my home network using windows so I can edit html in Frontpage 2000.

Talking with Clug and Tusker, I'm told the best thing to do is smb over ssh.

The Setup 

I'm running samba on cia.crra.org.nz

 

The Process
So, following the instructions at:  http://www.ibiblio.org/gferg/ldp/Samba-with-SSH/Samba-with-SSH.html 

 
  1. Logged on to bowenvale.pointclark.net as root and started screen so that the ssh tunnel doesn't close when I log off.
  2. # ssh -2 -q -f -N -g -L 139:farm:139
    farm is the netbios name on cia.crra.org.nz
    I set this up wrong the first time so I had to find the ssh sessions and kill them:  
    # netstat -anp

    # ssh -2 -q -f -N -g -L 139:localhost:139
  3. Create the folder where the remote system will be mounted to

    [root@bowenvale ~]# mkdir /mnt/cia.crra.org.nz
    [root@bowenvale ~]# mkdir /mnt/cia.crra.org.nz/graffiti
  4. Now to set up the smb connection

    [root@bowenvale ~]#  smbmount "\\\farm\graffiti" /mnt/cia.crra.org.nz/graffiti -o username=guest,password=,ip=127.0.0.1
    ERROR: Badly formed boolean in configuration file: "auto".
    Error connecting to 127.0.0.1 (Connection refused)
    25443: Connection to farm failed
    SMB connection failed

    And clearly I have done something else wrong.
ssh -2 -q -f -N -g -L 127.0.0.2:139:127.0.0.1:139 - This didn't work
 

Ok, haven't got this to work yet.  Thinking that making it work from putty direct to the machine might be easier but it means I can't automate a backup.

 

 

Setting Up the Farm Yard PDF Print

To set up machines for the Riccarton Net Resource Center we've made some scripts...

wget http://mozart.amiton.ltd.uk/postinst/postinst && chmod +x postinst

then edit /etc/hosts to include:
192.168.2.137  debcache

then ./postinst

Setting up Xfce4

 apt-get install Xfce4 - we thought would sort out dependencies.  It didn't.  We got...

 root@chicken:~# startxfce4
/usr/bin/startxfce4: Starting X server
/usr/bin/startxfce4: line 34: exec: xinit: not found

 See:  http://www.ecualug.org/?q=2006/08/31/forums/xfce4_en_debian_sarge or http://translate.google.com/translate?u=http%3A%2F%2Fwww.ecualug.org%2F%3Fq%3D2006%2F08%2F31%2Fforums%2Fxfce4_en_debian_sarge&langpair=es%7Cen&hl=en&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools (if you prefer english).

 We had already uninstalled aptitude, so...

apt-get install xbase-clients
apt-get install xfree86-common
apt-get install xserver-common
apt-get install xserver-xfree86
apt-get install x-window-system-Core

 

Setting up Opera

Get it first...

wget http://public.planetmirror.com/pub/opera/linux/910/final/en/i386/shared/opera_9.10-20061214.5-shared-qt_en_i386.deb 

Install the dependencies... 

root@sheep:~# apt-get install  liblcms1  libmng1 libaudio2  libqt3c102-mt

Install the package 

dpkg -i opera_9.10-20061214.5-shared-qt_en_i386.deb


Tips and Trix

# startx

 Start the xserver

# export DISPLAY=:0

Set the display variable so that when we run opera it knows where to start 

then run opera 

Monitor Settings

Find out about monitor settings - search log file, search on 'DDC'

 # xdpyinfo

This shows what's going on with current x server

vesa

Max display depth is only 16, 24 won't work.

Machines with 1mb video ram won't run more than 800 * 600.

Moving dialogue boxes around. 

Use Alt key and click to drag a window around Xfce4

 

# dpkg -L <package name>

To find out list of files in package.  This was useful to find out what the S3 driver name was that we used.

# apt-cache search --namesonly <search text>

This to search the list names only and not package descriptions. 

 

adduser

apt-get install xserver-xorg

How to start Opera automatically

.xsession in users home folder to run programs when x starts.

# start-stop-demon 

To start and stop a command.

 

 

Other bits Don likes...

 

apt-get install mc mysql-server webmin webmin-core webmin-mysql

 

Tips and Tricks to X PDF Print

Tips 1 - Prove presents of X

 # X -probeonly