Using rsync to Mirror Data to a Different Server

Like many things on this blog, I don’t use this enough to remember the full command when I need it. Like always, don’t just copy and paste this information. Use the man pages to verify what it is that you need to do.

rsync -a -v --delete --update --stats /path/to/local/data/ user@<server-name>:/path/to/folder/

This version of the command essentially maintains ownership and permissions while allowing for file changes, including file deletions, to be copied from the local server to another server. It mirrors the data on the local server to a second server. It also provides a listing of statistics when the command has completed.

A similar command using robocopy on MS systems was posted at an earlier date and can be found here:

Basic FreeBSD Desktop Setup

I haven’t setup a FreeBSD server in a while so I decided to have a look at FreeBSD 12.1, which I installed as a guest using VirtualBox. I also decided that I wanted a fairly basic desktop on this install. Below are my notes on what I did to setup the desktop after I had already installed the base FreeBSD system.

First – here is a quick list of commands for working with user setup and package management :

  • adduser - Add new user
  • rmuser - Remove a user
  • chpass - Allows for user modification, including shell
  • chsh - Change shell using editor, chsh -s does not use the editor
  • pw - Modify user and groups
    • Type “pw” to get basic help
    • Another example: "pw usermod help"
Working with packages:
  • pkg help
  • pkg info <name>
  • pkg search <name>
  • pkg search -o <name>   - use this one, provides path
  • pkg install <name>
  • pkg delete <name>
  • pkg upgrade
  • pkg autoremove   - remove stale dependencies
  • pkg clean - clean package cache
  • pkg clean -a   - clean all cached packages
  • pkg audit -F   - Check for vulns

Install bash and VIM:

pkg install bash bash-completion vim Edit vimrc: vim /usr/local/etc/vim/vimrc add: "set background=dark" - Easier to see text "set number" - Always display line numbers

Set up UTF-8:

vim /etc/login.conf (edit default class as below)
     :umask=022:\     (add “\” only)
     :charset=UTF-8:\
     :lang=en_US.UTF-8:

execute "cap_mkdb /etc/login.conf"

Edit /etc/profile:
   vim /etc/profile
        LANG=en_US.UTF-8; export LANG
        CHARSET=UTF-8; export CHARSET
        GDM_LANG=en_US.UTF-8; export GDM_LANG

Logout and login again
execute “locale"

Install Xorg, fonts, and XFCE:

pkg install xorg xfce
pkg install virtualbox-ose-additions
pkg install terminus-font liberation-fonts-ttf

execute "fc-cache -vf"

Add the following to /etc/rc.conf:

vim /etc/rc.conf
   dbus_enable="YES"
   vboxguest_enable="YES"
   vboxservice_enable="YES"

If /etc/X11/xorg.conf does not exist:

cd /root/
X -configure

Add these lines to the following:
vim xorg.conf.new

   Section "Files"
        FontPath     "/usr/local/share/fonts/terminus-font/"
        FontPath     "/usr/local/share/fonts/Liberation/"
        FontPath     "/usr/local/share/fonts/dejavu/"

   Section "Module"
        Load  "dri"
        Load  "freetype"
        Load  "bitmap"
        Load  "type1"

   Section "InputDevice"
        Driver      "vboxmouse"

   Section "Device"
        Option     "DRI" "true"
        Driver      "vboxvideo"

cp xorg.conf.new /etc/X11/xorg.conf

Add to ~/.xinitrc (for each user):

exec /usr/local/bin/startxfce4

Add user account:

adduser
passwd username
pw usermod username -G wheel,operator

As user:
vim .xinitrc
    exec /usr/local/bin/startxfce4

Login as user and start xorg:

startx

pfSense – Starting the console menu

My test environment at work sits behind a pfSense firewall. A typical installation does not protect the console menu; you simply connect to the console and the menu is there for your access. This can be turned off via the admin web interface under “system -> advanced -> admin-access” then under “Console Options.” Then, when you connect to the console you will need to provide a username and password. Once you are in, if you want to see the console menu, run the following command:

/etc/rc.initial