header

bashrc on FreeBSD

The default bashrc for freebsd is bland, black and white, so I looked for something to spice it up.
First I added color as well as some custom-ities to my two line prompt:

export PS1="e[32;40mt e[33;40mue[34;40m@e[31;40mh e[36;40mwne[37;40m#$ e[0m"

Then I added color to my ls’s. Once you experience the default linux coloring, going back is pretty hard.

CLICOLOR="YES";    export CLICOLOR
LSCOLORS="ExGxFxdxCxDxDxhbadExEx"; export LSCOLORS

This gives
the 24 hour time in green, followed by user (orange)@(blue)host(red), followed by the current path (light blue), then new line
followed by the number of commands done on this term thus far, followed by the “$” symbol.

Works great for me.

Of course, don’t forget to source it in your .bash_profile
source ~/.bashrc

Comments (0)

Maxtor Hard Drive, FreeBSD

I purchased a 200GB Maxtor 6Y200P0 hard drive for $45 after rebate about a year and a half ago. It had been working fine as a backup hard drive on my FreeBSD server. However, it recently failed on me. Directly after a power outage, I was receiving the following message:

FAILURE-READ_DMA status=51 error=40 LBA=135486975 mount = /dev/ad0s1d

Doing fsck -y /dev/ad0s1d, the check would complete without errors. But trying to mount the drive as rw would give me the following error:

mount: /dev/ad0s1d: Input/output error

I was able to mount it read-only to retrieve the data, but I really wanted to have it fixed so I could write to it again.

I tried to follow the FreeBSD handbook guide to reformatting the drive, but that did not complete, giving read/write errors.

It was suggested by cperciva@layeredtech that I

Overwrite that partition with zeroes (dd if=/dev/zero of=/dev/ad0s1d) and then newfs and mount (newfs /dev/ad0s1d && mount /dev/ad0s1d)

While that series of commands didn’t work (same input/output errors), doing effectively the same thing with the Maxtor diagnostics tool worked.

I went to Maxtor.com, and selected my model # (which seems to only work on IE…), went to Diagnostics, then downloaded PowerMax and put it on a floppy. Running a Basic Quick Test (90 Second) passed, but an Advanced Test (Full Read Scan) failed fairly early on. I was given two error codes, which are supposedly internal for Maxtor, and I guess are used for RMA processing. The codes were dea46771 and dea46761, which mean nothing to me.

So I then performed a Low Level Format (Quick) and Low Level Format (Full). This took the better part of 2 hours. After doing this, the Advanced Test completed. I was then able to format and partition the drive via the FreeBSD Handbook: Adding Disks section.

I have no doubt that the reason the hard drive was failing was the heat inside. I have two 200 GB hard drives and 1 40 GB hard drive all practically laying on top of each other in the hard drive bay. I’m just squeezing as much life as I can out of this old system. Next system, hard drive coolers, video card coolers, {insert third term to match form} coolers, Oh my!

Comments (1)

ftponly shell for freebsd

I was looking for a way to restrict regular users of my server from accessing the shell. A google search for ftponly found this method:

Save the following into /usr/local/bin/ftponly, chmod it 755 and add it to /etc/shells. Then change the shell of each of the users to this, and they will be restricted from ssh “interactive” access.

#!/bin/sh
#
# ftponly shell
#
trap “/bin/echo Sorry; exit 0″ 1 2 3 4 5 6 7 10 15
#
IFS=”"
Admin=access@host.some.domain
System=`/usr/ucb/hostname`@`/usr/bin/domainname`
#
/bin/echo
/bin/echo “***********************************”
/bin/echo ” You are NOT allowed interactive access to $System.”
/bin/echo
/bin/echo ” User accounts are restricted to ftp and web access.”
/bin/echo
/bin/echo ” Direct questions concerning this policy to $Admin.”
/bin/echo “***********************************”
/bin/echo
#
# C’ya
#
exit 0

Comments (0)

Mysql install on FreeBSD

I’ve had enough problems with this to know that I need to write down what I need to do to install mysql on FreeBSD. Here are the steps I took to do it successfully.

cd /usr/ports/databases/mysql41-server/
make install clean
/usr/local/bin/mysql_install_db
chown -R mysql /var/db/mysql/
chgrp -R mysql /var/db/mysql/
/usr/local/bin/mysqld_safe –user=mysql &
/usr/local/bin/mysqladmin -u root password newpassword

Edit 8/17:
{edit /etc/rc.conf and add}
mysql_enable="YES"
Thanks lucas

That works.

Comments (60)

Freebsd and Proftpd

I just installed Proftpd from FreeBSD‘s ports (/usr/ports/ftp/proftpd/) today and noticed that when I tried to start it, it wouldn’t start by default. I would get this:


-su# /usr/local/etc/rc.d/proftpd.sh start
Starting proftpd.
-su# /usr/local/etc/rc.d/proftpd.sh status
proftpd is not running.

I inspected /var/log/messages, and found this message
Feb 10 15:59:42 {hostname} proftpd [4375]: {hostname} – error opening scoreboard: No such file or directory.

What you have to do is edit /usr/local/etc/proftpd.conf and add the line

ScoreboardFile /var/run/proftpd.scoreboard

then execute the command

touch /var/run/proftpd.scoreboard

to create the file. Then when you run the startup script, you will get this message

-su# /usr/local/etc/rc.d/proftpd.sh start
Starting proftpd.
-su# /usr/local/etc/rc.d/proftpd.sh status
proftpd is running as pid 4576.

Comments (6)


blogtimes