I recently got a laptop to use for web development work when I
travel. I wanted a simple way to sync up the data between it and my
Desktop computer so that they would both have the same bookmarks,
emails, instant message logs, etc. Along comes unison to save the day.
It ended up being MUCH easier than I expected.
Both computers are running Ubuntu 7.10 “Gutsy Gibbon” and are connected
to my router–the Desktop is hard wired (Ethernet) and the laptop uses
a WiFi connection. The desktop will be running an SSH server which will
be used by Unison on the laptop to synchronize the folders of my
choosing. The laptop will initialize the sync through a unison GUI:
gtk-unison
The laptop will be connecting to the desktop over an SSH (secure
shell) connection. Moreover, I’ll be able to connect to the desktop
from my laptop and browse/copy any files I need.
First, I changed the desktop computer’s “Host Name” to something
that makes sense in the ‘Network Settings’ dialog (‘System’ >
‘Administration’ > ‘Network’). I used “Desktop”.
Next, I installed the necessary software on the desktop:
sudo aptitude install openssh-server unison
Then, I configured the SSH server so that my user “micah” could log
in over an SSH connection and that root login was NOT allowed. I did
this by editing ‘/etc/ssh/sshd_config’. I changed:
AllowRootLogin yes
to:
AllowRootLogin no
And then I added:
AllowUsers micah
And finally, restarted the SSH service:
sudo /etc/init.d/ssh
The desktop computer already has all the data I need the computers
to share. However, there is one “gotcha” for Mozilla products. They use
a random folder name for you profile. I’m going to want this to be the
same so that both computers versions of Firefox and Thunderbird share
data.
For Firefox I renamed the profile folder in .mozilla/firefox to
‘micah.default’ and edited .mozilla/firefox/profiles.ini to reflect
this change. I did the same thing in .mozilla-thunderbird/ for
Thunderbird–my email client.
On the laptop, I first installed all the software that will be
sharing this data. For me, this was Firefox, Pidgin (formerly gaim),
Thunderbird, MySQL Query Browser, and gFTP. Next, I renamed the
profiles for Mozilla products as described in the previous section.
Finally, I installed unison and it’s graphical user interface:
sudo aptitude install unison unison-gtk
The unison program will now be available from ‘Applications’ >
‘Internet’ > ‘Unison’, however, we’ll need to setup a profile to
tell unison what to synchronize. We can do this with a profile file.
I’m going to create one called “Desktop” by creating a text file in
~/.unison as follows:
mkdir ~/.unison
touch Desktop.prf
gedit Desktop.prf
There are numerous ways you can setup your profile. The easiest way
would be to simply sync up the entire home folder, however, I have a
LOT of data in my home directory and don’t want it all synchronized.
Furthermore, my desktop is an AMD64 architecture while my laptop is
i386 which will cause problems with Firefox/Thunderbird if they share
extensions and plugins. I need to share ONLY the data.
Here’s my Desktop.prf file. The comments should let you know what’s going on:
### ROOT SYNC PATHS ###
# first root is my home directory on this laptop
root = /home/micah/
# second directory is my desktop's home folder over SSH
root = ssh://micah@192.168.1.2//home/micah/
### PATHS TO SYNCHRONIZE ###
# sync all of my email data (will ignore parts later)
path = .mozilla-thunderbird/micah.default/
# only sync up bookmarks for firefox
path = .mozilla/firefox/micah.default/bookmarks.html
# sync all gFTP for the bookmarks and cache
path = .gftp/
# gaim/pidgin IM client logs and settings
path = .purple/
# MySQL Query Browser information and history
path = .mysqlgui/
# Personal folders
path = finances/
path = websites/
path = projects/
path = robotics/
path = email_signature
### IGNORE RULES ###
# ignore archived backups
ignore = Path websites/archive/*
# ignore the extensions folder in thunderbird as they are architecture-specific
ignore = Path .mozilla-thunderbird/micah.default/extensions/*
# I don't think these will break anything, but let's ignore anyway
ignore = Path .mozilla-thunderbird/micah.default/compatibility.ini
ignore = Path .mozilla-thunderbird/micah.default/install.log
Now, I can run Unison and select my “Desktop” profile. I do this
before leaving on a trip with my laptop and then again when I return.
### PROBL:
dmesg: bsalg: parser failed
### SOL:
in kernel pe la setarile de iptables: Basic SNMP-ALG support (EXPERIMENTAL) OFF!### PROB:
dmesg: ip_conntrack: table full, dropping packet.
### SOL:
in etc/sysctl.conf: net.ipv4.ip_conntrack_max = 50000### PROB:
dmesg:
Neighbour table overflow.
printk: 137 messages suppressed.
Neighbour table overflow.
### SOL:
write these lines below to /etc/sysctl.conf:
net.ipv4.neigh.default.gc_thresh1 = 1024
net.ipv4.neigh.default.gc_thresh2 = 2048
net.ipv4.neigh.default.gc_thresh3 = 8192
sau toate cu 8192
modificare direct in /proc/sys/net/ipv4/neigh/default/gc_thresh1 ..2..3
in xorg la NVIDIA:
Option “UseEdidDpi” “FALSE”
Option “DPI” “96 x 96″
in about:config:
// TrueType
user_pref (“font.FreeType2.enable”, true);
user_pref (“font.freetype2.shared-library”, “libfreetype.so.6″);
// if libfreetype was built without hinting compiled in
// it is best to leave hinting off
user_pref (“font.FreeType2.autohinted”, true);
user_pref (“font.FreeType2.unhinted”, true);
// below a certain pixel size anti-aliased fonts produce poor results
user_pref (“font.antialias.min”, 0);
user_pref (“font.embedded_bitmaps.max”, 1000000);
// sample user_pref s for TrueType font dirs
user_pref (“font.directory.truetype.1″, “/usr/share/fonts/ttf-bitstream-vera”);
user_pref (“font.directory.truetype.2″, “/usr/share/fonts/TTF”);
user_pref (“font.directory.truetype.3″, “/usr/share/fonts/corefonts”);
user_pref (“font.directory.truetype.4″, “/usr/share/fonts/freefont”);
user_pref (“font.FreeType2.printing”, true);
la setari:
Proportional: Serif (Size: 16)
Serif: Bitstream vera serif
Sans-serif: Bitstream vera sans
Monospace: Bitstream vera sans mono (Size: 12)
minimum: 12
allow other apps to use their fonts
important sa ai multe fonturi in X mai ales cele din vindoza
just copy .Xauthority from the user running X to the other user’s home
or
#ln -s /home/user/.Xauthority /root
* Search and list all files from current directory and down for the string ABC:
find ./ -name “*” -exec grep -H ABC {} \;
find ./ -type f -print | xargs grep -H “ABC” /dev/null
egrep -r ABC *
* Find all files of a given type from current directory on down:
find ./ -name “*.conf” -print
* Find all user files larger than 5Mb:
find /home -size +5000000c -print
* Find all files owned by a user (defined by user id number. see /etc/passwd) on the system: (could take a very long time)
find / -user 501 -print
* Find all files created or updated in the last five minutes: (Great for finding effects of make install)
find / -cmin -5
* Find all users in group 20 and change them to group 102: (execute as root)
find / -group 20 -exec chown :102 {} \;
* Find all suid and setgid executables:
find / \( -perm -4000 -o -perm -2000 \) -type f -exec ls -ldb {} \;
find / -type f -perm +6000 -ls
Note: suid executable binaries are programs which switch to root
privaleges to perform their tasks. These are created by applying a
“stickey” bit: chmod +s. These programs should be watched as they are
often the first point of entry for hackers. Thus it is prudent to run
this command and remove the “stickey” bits from executables which
either won’t be used or are not required by users. chmod -s filename
* Find all world writable directories:
find / -perm -0002 -type d -print
* Find all world writable files:
find / -perm -0002 -type f -print
find / -perm -2 ! -type l -ls
* Find files with no user:
find / -nouser -o -nogroup -print
* Find files modified in the last two days:
find / -mtime 2 -o -ctime 2
* Compare two drives to see if all files are identical:
find / -path /proc -prune -o -path /new-disk -prune -o -xtype f -exec cmp {} /new-disk{} \;
AuthUserFile /usr/local/etc/apache22/passwd/KB
AuthName “Authorization Required”
AuthType Basic
require valid-user
This page is a small HOWTO about the advanced linux routing…
First of all let me tell you where you can find the best source of information about the advanced routing under Linux. Most of you probably know or heard about the Linux Advanced Routing & Traffic Control site. There you can see a very comprehensive source of knowledge based not only on documentation but by easy to understand examples…
Credits: Linux Advanced Routing & Traffic Control, Thea
Ok, then…
This page will show you how to set a linux box to use 2 different ISPs on the same time…
First example:
Goal: To route packets that came from 4 network to different ISPs
Let’s presume that you have two ISPs. In the following examples I’ll use RDS and ASTRAL (two large ISPs from my country)
For the ASCII art and lynx console browser fans I’ll use this kind of chart:
________
+-------------+ /
| ISP 1 | /
+-------------+ (RDS) +------+
| | gw 10.1.1.1 | /
+------+-------+ +-------------+ /
+----------------+ | eth1 | /
| | | | |
| Local networks +----+ Linux router | | Internet cloud
| | | | |
+----------------+ | eth2 | \
+------+-------+ +-------------+ \
| | ISP 2 | \
+-------------+ (ASTRAL) +------+
| gw 10.8.8.1 | \
+-------------+ \________
We will work only on Linux router box. From the root prompter do:
echo 1 RDS >> /etc/iproute2/rt_tables echo 2 ASTRAL >> /etc/iproute2/rt_tables
The /etc/iproute2/rt_table content after previous commands:
# # reserved values # 255 local 254 main 253 default 0 unspec # # local # #1 inr.ruhep 1 RDS 2 ASTRAL
Now we have three routing tables as follows: RDS table, ASTRAL table and the main table…
Let’s fill up every table with the defaults routes:
The next step is to have some routing rules and routes:
For the RDS table:
ip route add default via 10.1.1.1 dev eth1 table RDS ip rule add from 10.11.11.0/24 table RDS ip rule add from 10.12.12.0/24 table RDS
For the ASTRAL table:
ip route add default via 10.8.8.1 dev eth2 table ASTRAL ip rule add from 10.22.22.0/24 table ASTRAL ip rule add from 10.33.33.0/24 table ASTRAL
To see the routing tables:
ip route show table ASTRAL ip route show table RDS ip route show table main # it's the same as "route -n" but in different format...
To see the routing tables:
ip rule show # all the rule list ip rule show | grep ASTRAL # only for ASRAL ip rule show | grep RDS # only for RDS
Let me explain the above rules.
The packets that came from the 10.11.11.0/24 and 10.12.12.0/24 networks will go to the RDS routing table and then (because we have a default route) will be passed to the RDS gateway. And similar, the packets that came from the 10.22.22.0/24 and 10.33.33.0/24 network will go to the ASTRAL gateway…
What is happening with the packets that came from other networks that are not shown in the above rules? Well, they just simply go to main routing table and follow the routing rules that reside there… If you want to block them to go to internet just delete the default route from the main table… (of course, doing that your router can not longer go to interent).
Second example:
Goal: To route the packets having the destination port 22/tcp to the RDS and 80/tcp to the ASTRAL (no matter what network generates them).
This example it is almost the same as the first one except that we will use iptables to mark the packets.
Same chart…
________
+-------------+ /
| ISP 1 | /
+-------------+ (RDS) +------+
| | gw 10.1.1.1 | /
+------+-------+ +-------------+ /
+----------------+ | eth1 | /
| | | | |
| Local networks +----+ Linux router | | Internet cloud
| | | | |
+----------------+ | eth2 | \
+------+-------+ +-------------+ \
| | ISP 2 | \
+-------------+ (ASTRAL) +------+
| gw 10.8.8.1 | \
+-------------+ \________
Same /etc/iproute2/rt_table content:
# # reserved values # 255 local 254 main 253 default 0 unspec # # local # #1 inr.ruhep 1 RDS 2 ASTRAL
Before you start check your iptables configuration. I strongly recommend to read about iptables if you are unsure about what you will doing next.
For more documentation go to iptables home page or you can download a good documentation from this site (Security & Privacy Section) or directly from here.
To mark the packets that have the 22 and 80 as destination port we will use the MANGLE table…
iptables -A PREROUTING -t mangle -i eth0 -p tcp --dport 22 -j MARK --set-mark 1 iptables -A PREROUTING -t mangle -i eth0 -p tcp --dprot 80 -j MARK --set-mark 2
For the RDS table:
ip route add default via 10.1.1.1 dev eth1 table RDS # the same like in the first example
For the ASTRAL table:
ip route add default via 10.8.8.1 dev eth2 table ASTRAL # the same like in the first example
The next step is to have some routing rules based by the marked packets:
For the RDS:
ip rule add from all fwmark 1 table RDS
For the ASTRAL:
ip rule add from all fwmark 2 table ASTRAL
You can use the same commands to see the routing tables and rule lists as in the first example.
Now you have a routing solution based by the destination port…
cat /etc/bluetooth/serial.service
[Bluetooth Service]
Identifier=serial
Name=Serial service
Description=Bluetooth Serial Port service
Autostart=true