FreeBSD Desktop Tips

file list:

/boot/loader.conf

/etc/rc.conf

/etc/devfs.conf

/etc/sysctl.conf

/usr/local/etc/PolicyKit/PolicyKit.conf

/etc/fstab

/etc/devfs.rules

-----------------------------------------------------------------------

root@it-90# cat /boot/loader.conf
# Kernel Options
kern.ipc.shmseg=1024
kern.ipc.shmmni=1024

# Enable the splash screen
vesa_load="YES"
splash_pcx_load="YES"
bitmap_load="YES"
bitmap_name="/boot/loading-screen.pcx"<br /><br /># Load Wireless Support<br />if_ipw_load="YES"
if_iwi_load="YES"
if_wpi_load="YES"
if_iwn_load="YES"
legal.intel_ipw.license_ack=1
legal.intel_iwi.license_ack=1
legal.intel_wpi.license_ack=1
legal.intel_iwn.license_ack=1

# Load mmc card-reader support
mmc_load="YES"
mmcsd_load="YES"<br /><br /># Load sata device support<br />ahci_load="YES"<br />sdhci_load="YES"<br /><br /># Load support for scd<br />scd_load="YES"<br /><br /># Load sound-support<br />sound_load="YES"<br />snd_uaudio_load="YES"<br /><br /># Load geom support<br />geom_journal_load="YES"<br />geom_uzip_load="YES"<br />geom_mirror_load="YES"<br />geom_eli_load="YES"<br /><br /># Load File-System Support<br />libiconv_load="YES"<br />libmchain_load="YES"<br />cd9660_iconv_load="YES"<br />msdosfs_iconv_load="YES"<br />ntfs_load="YES"<br />ntfs_iconv_load="YES"<br />udf_load="YES"<br />udf_iconv_load="YES"<br />zfs_load="YES"<br />tmpfs_load="YES"<br />sem_load="YES"<br />root@it-90#<br />-----------------------------------------------------------------------</p> <p style="text-align: left;">

root@it-90# cat /etc/rc.conf
background_dhclient="YES"
compat5x_enable="YES"
sshd_enable="YES"
usbd_enable="YES"
devd_enable="YES"
devfs_system_ruleset="devfsrules_common"
ldconfig_paths="/usr/lib/compat /usr/local/lib /usr/local/kde4/lib /usr/local/lib/compat/pkg"<br /><br /># Disable Sendmail by default<br />sendmail_enable="NONE"

# Enable console mouse
moused_type="auto"
moused_enable="YES"

# Enable the pcbsd startup / shutdown scripts
pcbsdinit_enable="YES"

#Enable samba server
samba_enable="YES"
winbindd_enable="YES"

# Disable LPD
lpd_enable="NO"

# Enable CUPS
cupsd_enable="YES"
linux_enable="YES"

# FSCK Enhancements
fsck_y_enable="YES"
background_fsck="NO"

# Denyhosts Startup
#denyhosts_enable="YES"

# powerd: adaptive speed while on AC power, adaptive while on battery power
# WARNING: May cause crashes with nvidia driver
#powerd_enable="YES"
#powerd_flags="-a adaptive -b adaptive" # set CPU frequency

# enable HAL / DBUS
dbus_enable="YES"
polkitd_enable="YES"<br />hald_enable="YES"

# Enables support for HPLIP
hpiod_enable="NO"
hpssd_enable="NO"

# Enable the firewall
#pf_rules="/etc/pf.conf"<br />#pf_enable="YES"
#pf_flags=""

# Enable ipfw and open it by default since we have PF
#firewall_enable="YES"
#firewall_type="open"

# Enable sound-support
snddetect_enable="YES"<br />mixer_enable="YES"<br /><br /># Enable avahi_daemon<br />avahi_daemon_enable="YES"<br /><br /># Run the port jail<br />portjail_enable="YES"<br /><br /># Added for sound support in the portjail, access to /dev/random, /dev/null, etc.<br />jail_pcbsd_devfs_enable="YES"<br /><br /># Start the swapmonitor<br />swapmonitor_enable="YES"<br /><br /># Enable IPV6 support<br />ipv6_enable="YES"<br /><br /># Enable BSDStats<br />bsdstats_enable="YES"<br /><br />warden_enable="YES"<br />ntpd_enable="YES"<br />ntpd_sync_on_start="YES"<br />keymap="us.iso"<br /># Auto-Enabled NICs from pc-sysinstall<br />ifconfig_re0="DHCP"<br />hostname="it-90.gbgnetwork.net"<br /><br />#ntfs<br />fusefs_enable="YES"<br />root@it-90#</p> <p style="text-align: left;">-----------------------------------------------------------------------

root@it-90# cat /etc/devfs.conf
# Copyright (c) 2003 The FreeBSD Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: src/etc/devfs.conf,v 1.2 2004/06/06 11:46:27 schweikh Exp $

# These are examples of how to configure devices using /etc/rc.d/devfs.
# The first parameter is always the action to take, the second is always the
# existing device created by devfs, and the last is what you want to change.
# The name of the action is only significant to the first unique character.
#
# Examples:

# Historically X depended on this, but version 4.3.0 doesn't seem to anymore
#link ttyv0 vga

# Commonly used by many ports
link cd0 cdrom
link cd0 dvd

# Allow a user in the wheel group to query the smb0 device
#perm smb0 0660

# Allow members of group operator to cat things to the speaker
#own speaker root:operator
#perm speaker 0660

# Allow all users to access CD's
perm /dev/acd0 0666
perm /dev/acd1 0666
perm /dev/cd0 0666
perm /dev/cd1 0666

# Allow all USB Devices to be mounted
perm /dev/da0 0666
perm /dev/da1 0666
perm /dev/da2 0666
perm /dev/da3 0666

# Misc other devices
perm /dev/pass0 0666
perm /dev/xpt0 0666
perm /dev/agpart 0666
perm /dev/uscanner0 0666
root@it-90#
-----------------------------------------------------------------------

root@it-90# cat /etc/sysctl.conf
# $FreeBSD: src/etc/sysctl.conf,v 1.8 2003/03/13 18:43:50 mux Exp $
#
# This file is read when going to multi-user and its contents piped thru
# ``sysctl'' to adjust kernel values. ``man 5 sysctl.conf'' for details.
#

# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0

# Disable coredump
kern.coredump=0

# Up the maxfiles to 4x default
kern.maxfiles=49312

# Allow users to mount CD's
vfs.usermount=1

# Enable more sound channels
dev.pcm.0.play.vchans=4
dev.pcm.0.rec.vchans=4

# Autodetect the most recent sound card. Uncomment for Digital output / USB
#hw.snd.default_auto=1

# Allow pinging in jails
security.jail.allow_raw_sockets=1

# Required for postgres
security.jail.sysvipc_allowed=1

# Required for smb
security.jail.mount_allowed=1

# Solves permission problems for some ports
security.jail.chflags_allowed=1
root@it-90#
-----------------------------------------------------------------------

root@it-90# cat /usr/local/etc/PolicyKit/PolicyKit.conf
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- --><br /><br /><!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"<br />"http://hal.freedesktop.org/releases/PolicyKit/1.0/config.dtd"><br /><br /><!-- See the manual page PolicyKit.conf(5) for file format --><br /><br /><config version="0.1"><br /> <define_admin_auth group="operator"/><br /> <match action="org.freedesktop.hal.storage.mount-removable"><br /> <return result="yes"/><br /> </match><br /> <match action="org.freedesktop.hal.storage.mount-fixed"><br /> <return result="yes"/><br /> </match><br /> <match action="org.freedesktop.hal.storage.eject"><br /> <return result="yes"/><br /> </match><br /></config><br />root@it-90#<br />-----------------------------------------------------------------------</p> <p style="text-align: left;">root@it-90# cat /etc/fstab
# Device Mountpoint FStype Options Dump Pass
/dev/label/rootfs0 / ufs rw,noatime 1 1
/dev/label/swap0 none swap sw 0 0
/dev/label/var0 /var ufs rw,noatime 1 1
/dev/label/usr0 /usr ufs rw,noatime 1 1
procfs /proc procfs rw 0 0
linprocfs /compat/linux/proc linprocfs rw 0 0
tmpfs /tmp tmpfs rw,mode=1777 0 0
#/dev/ad4s1 /home/mehran/windows/c ntfs-3g rw,late 0 0
#/dev/ad4s2 /home/mehran/windows/d ntfs-3g rw,late 0 0
root@it-90#

-----------------------------------------------------------------------


root@it-90# cat /etc/devfs.rules
[devfsrules_common=7]
add path 'ad[0-9]*' mode 666 group operator
add path 'acd[0-9]*' mode 666 group operator
add path 'cd[0-9]*' mode 666 group operator
add path 'pass[0-9]*' mode 666 group operator
add path 'xpt[0-9]*' mode 666 group operator
add path 'ugen[0-9]*' mode 666 group operator
add path 'usbctl' mode 666 group operator
add path 'usb/*' mode 666 group operator
add path 'lpt[0-9]*' mode 666 group cups
add path 'ulpt[0-9]*' mode 666 group cups
add path 'unlpt[0-9]*' mode 666 group cups
add path 'fd[0-9]*' mode 666 group operator
add path 'uscan[0-9]*' mode 666 group operator
root@it-90#

-----------------------------------------------------------------------
#Add the user to the operators group for k3b && su
[mbahmani@it-27 /usr/home/mbahmani]$pw user mod mbahmani -G wheel,operator

-----------------------------------------------------------------------

[mbahmani@it-27 /usr/home/mbahmani]$echo "exec /usr/local/kde4/bin/startkde4">~/.xinitrc
[mbahmani@it-27 /usr/home/mbahmani]$echo vfs.usermount=1 >> /etc/sysctl.conf
[mbahmani@it-27 /usr/home/mbahmani]$ cat /etc/ttys |grep ttyv8
#ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure
ttyv8 "/usr/local/kde4/bin/kdm -nodaemon" xterm on secure
[mbahmani@it-27 /usr/home/mbahmani]$sysctl -w vfs.usermount=1

-----------------------------------------------------------------------

root@it-90# portsnap fetch

root@it-90# portsnap (assuming you do not have a ports tree)

root@it-90# portsnap fetch (assuming you have a ports tree)

# make makesum in the port's directory, that will re-calculate the hashes.
cd /usr/ports/
[root@it-27 /usr/ports]# make makesum
pkgdb -F (fix any inconsistencies)

-----------------------------------------------------------------------

portsupgrade -P -F -a (fetch update)
portsupgrade -a (will update all ports installed)
[mbahmani@it-27 /usr/home/mbahmani]$ sudo /usr/libexec/locate.updatedb
#(fix any inconsistencies)
[root@it-27 /usr/ports]#pkgdb -F

-------------------------------------
How do I install and search FreeBSD ports or a package


Task: Find out FreeBSD port name or package name

There are 3 different methods available to search a port name. Use any one of the following method only.
#1 : Using whereis command

If you know the exact name of the port, but just need to find out which category it is in, you can use the whereis(1) command. Simply type whereis file, where file is the program you want to install.
# whereis php5

Output:
php5: /usr/ports/lang/php5

# whereis lighttpd

Output:
lighttpd: /usr/ports/www/lighttpd
#2: Using make command

Change directory to /usr/ports
# cd /usr/ports

To search type the command as follows:
# make search name="package-name"<br /><br />For example search a package called lighttpd or php<br /># make search name="php"<br /><br />OR<br /># make search name="lighttpd"<br /><br />Output:<br />Port: lighttpd-1.4.13_2<br />Path: /usr/ports/www/lighttpd<br />Info: A secure, fast, compliant, and very flexible Web Server<br />Maint: This e-mail address is being protected from spambots. You need JavaScript enabled to view it. <br />B-deps: autoconf-2.59_2 libtool-1.5.22_4 m4-1.4.8_1 pcre-7.0_1 perl-5.8.8<br />R-deps: pcre-7.0_1<br />WWW: http://www.lighttpd.net/<br />#3: Using locate command<br /><br />You can also use locate command:<br /># locate php<br /># locate php | grep php5<br />Task: Install FreeBSD port<br /><br />Above output displays port Path - /usr/ports/www/lighttpd. Just change directory to /usr/ports/www/lighttpd<br /># cd /usr/ports/www/lighttpd<br /><br />Now install a port:<br /># make; make install<br /><br />Clean the source code tree:<br /># make clean</p> <p style="text-align: left;">

------------------------------------------------------------------

-----------------------------

#RDP
[mbahmani@it-27 /usr/home/mbahmani]$ cd /usr/ports/net/remmina/
[mbahmani@it-27 /usr/ports/net/remmina]$ make install


-------------------------------------------------

#Installing Flash
#Since the Flash Player from Macromedia is only distributed in binary form and only for Linux, we need to install a wrapper to make it accessible for Konqueror. Install nspluginwrapper and the actual Flash Player linux-flashplugin7 from ports:
[mbahmani@it-27 /usr/home/mbahmani]$cd /usr/ports/www/nspluginwrapper && make install clean
[mbahmani@it-27 /usr/home/mbahmani]$cd /usr/ports/www/linux-flashplugin9 && make install clean
#Setting up nspluginwrapper
#Run
[mbahmani@it-27 /usr/home/mbahmani]$nspluginwrapper -v -a -i
#This command lets nspluginwrapper search for installed plugins and generate wrapper libraries in ~/.mozilla/plugins. These wrapper libraries will also be visible to and usable by native FreeBSD builds of Firefox, Mozilla and Seamonkey.

Setting up Konqueror
In order for Konqueror to find the plugin for the Flash Player, you might have to add an additional search-path to the plugins-section of Konqueror's settings.
Open Konqueror.
In the Konqueror menubar, traverse the submenus until you arrive at:
Settings -> Configure Konqueror -> Plugins
Proceed to the Scan tab.
Select the Scan for New Plugins button.

Plugins are now searched and if everything worked well, you should see an entry for the Flash-plugin when you switch to the Plugins tab

-------------------------------------------------
#k3b

cd /usr/ports/sysutils/cdrdao
make
make install
make clean
cd /usr/local/bin
chmod u+s cdrdao

#I recommend using k3b for burning, it's easy to use and efficient.

cd /usr/ports/sysutils/k3b
make
make install
make clean

-------------------------------------------------
#cupsd

cd /usr/ports/print/cups && make install clean

Other optional, but recommended, ports or packages are print/gutenprint-cups and print/hplip, both of which add drivers and utilities for a variety of printers. Once installed, the CUPS configuration files can be found in the directory /usr/local/etc/cups.

In order to enable CUPS printing under certain Microsoft® Windows® clients, the line below should be uncommented in /usr/local/etc/cups/mime.types and /usr/local/etc/cups/mime.convs:
application/octet-stream
# /etc/rc.d/devfs restart
# /usr/local/etc/rc.d/cupsd restart


UNIX® Clients
ipp://server-name-or-ip/printers/printername
http://server-name-or-ip:631/printers/printername

If the CUPS clients have difficulty finding other CUPS printers shared across the network, sometimes it is helpful to add or create a file /usr/local/etc/cups/client.conf with a single entry as follows:
ServerName server-ip

In this case, server-ip would be replaced by the local IP address of the CUPS server on the network.


Windows® Clients
http://server-name-or-ip:631/printers/printername


-------------------------------------------------
[root@it-27 /usr/ports/net/pptpclient]# cd /usr/ports/net/pptpclient
[root@it-27 /usr/ports/net/pptpclient]# make install
[root@it-27 /usr/ports/net/pptpclient]# cd /etc/ppp
[root@it-27 /etc/ppp]# mv ppp.conf ppp.conf.orig
[root@it-27 /etc/ppp]# cp /usr/local/share/examples/pptpclient/ppp.conf .
[root@it-27 /etc/ppp]# chmod 640 ppp.conf
[root@it-27 /etc/ppp]#

$ less ppp.conf
THEOFFICE:
set authname myusername
set authkey mypassword
set timeout 0
set ifaddr 0 0
add 10.5.9.0/24 HISADDR
alias enable yes

THEOFFICE: This is just a label. Give it a descriptive value. You will use this value on the command line when you invoke pptp.
myusername: This is the user name assigned to you and which you use to authenticate at the VPN server.
mypassword: This is the password you use in combination with the user name above.
10.5.9.0/24: This is the IP address of the VPN which you will be connecting to. Talk to your VPN administrator to find out what value you should be using. This is the value I will be using later when I get a static route.


/usr/local/sbin/pptp a.b.c.d THEOFFICE

$ less /usr/local/etc/rc.d/pptp.sh
#!/bin/sh

case "$1" in
start)
/usr/local/sbin/pptp a.b.c.d THEOFFICE &
;;

stop)
if [ -f /var/run/tun0.pid ]
then
kill -TERM `cat /var/run/tun0.pid`
fi
;;

*)
echo "Usage: ^Basename $0 {start|stop}" >&2
;;
esac

exit 0
---------------
Make sure to do a chmod +x on the script (all files in /usr/local/etc/rc.d/ must be .sh and +x in order to be run at boot time.

Optional - default routes

static_routes="MyOffice"<br />route_MyOffice="10.5.9.0/24 192.168.0.20"<br /><br />-----------------------------------------------<br />#KDE<br />cd /usr/ports/x11/kde4 && make install clean</p>"