Static Mapping NFS

Static Mapping for NFS is used for mapping a local user or group id to a remote user or remote id. So you dont have to sync. user database on both machines.

Make the file /etc/nfs/maps.map and put this lines in

uid 1000 0

that will map remote userid 1000 to local userid 0 (root).

you can add as many as you want, use “gid” if it’s group id’s

and then in /etc/exports

add

map_static=/etc/nfs/maps.map

like this

/share 192.168.0.1(rw,no_root_squash,map_static=/etc/nfs/maps.map)

Have fun’

Udgivet i Knowledge Base, Networking, Old Base | Skriv en kommentar

ISO countrycodes

ad Andorra, Principality of
ae United Arab Emirates
af Afghanistan, Islamic State of
ag Antigua and Barbuda
ai Anguilla
al Albania
am Armenia
an Netherlands Antilles
ao Angola
aq Antarctica
ar Argentina
arpa Old style Arpanet
as American Samoa
at Austria
au Australia
aw Aruba
az Azerbaidjan
ba Bosnia-Herzegovina
bb Barbados
bd Bangladesh
be Belgium
bf Burkina Faso
bg Bulgaria
bh Bahrain
bi Burundi
bj Benin
bm Bermuda
bn Brunei Darussalam
bo Bolivia
br Brazil
bs Bahamas
bt Bhutan
bv Bouvet Island
bw Botswana
by Belarus
bz Belize
ca Canada
cc Cocos (Keeling) Islands
cf Central African Republic
cd Congo, The Democratic Republic of the
cg Congo
ch Switzerland
ci Ivory Coast (Cote D’Ivoire)
ck Cook Islands
cl Chile
cm Cameroon
cn China
co Colombia
com Commercial
cr Costa Rica
cs Former Czechoslovakia
cu Cuba
cv Cape Verde
cx Christmas Island
cy Cyprus
cz Czech Republic
de Germany
dj Djibouti
dk Denmark
dm Dominica
do Dominican Republic
dz Algeria
ec Ecuador
edu Educational
ee Estonia
eg Egypt
eh Western Sahara
er Eritrea
es Spain
et Ethiopia
fi Finland
fj Fiji
fk Falkland Islands
fm Micronesia
fo Faroe Islands
fr France
fx France (European Territory)
ga Gabon
gb Great Britain
gd Grenada
ge Georgia
gf French Guyana
gh Ghana
gi Gibraltar
gl Greenland
gm Gambia
gn Guinea
gov USA Government
gp Guadeloupe (French)
gq Equatorial Guinea
gr Greece
gs S. Georgia & S. Sandwich Isls.
gt Guatemala
gu Guam (USA)
gw Guinea Bissau
gy Guyana
hk Hong Kong
hm Heard and McDonald Islands
hn Honduras
hr Croatia
ht Haiti
hu Hungary
id Indonesia
ie Ireland
il Israel
in India
int International
io British Indian Ocean Territory
iq Iraq
ir Iran
is Iceland
it Italy
jm Jamaica
jo Jordan
jp Japan
ke Kenya
kg Kyrgyz Republic (Kyrgyzstan)
kh Cambodia, Kingdom of
ki Kiribati
km Comoros
kn Saint Kitts & Nevis Anguilla
kp North Korea
kr South Korea
kw Kuwait
ky Cayman Islands
kz Kazakhstan
la Laos
lb Lebanon
lc Saint Lucia
li Liechtenstein
lk Sri Lanka
lr Liberia
ls Lesotho
lt Lithuania
lu Luxembourg
lv Latvia
ly Libya
ma Morocco
mc Monaco
md Moldavia
mg Madagascar
mh Marshall Islands
mil USA Military
mk Macedonia
ml Mali
mm Myanmar
mn Mongolia
mo Macau
mp Northern Mariana Islands
mq Martinique (French)
mr Mauritania
ms Montserrat
mt Malta
mu Mauritius
mv Maldives
mw Malawi
mx Mexico
my Malaysia
mz Mozambique
na Namibia
nato NATO (this was purged in 1996 – see hq.nato.int)
nc New Caledonia (French)
ne Niger
net Network
nf Norfolk Island
ng Nigeria
ni Nicaragua
nl Netherlands
no Norway
np Nepal
nr Nauru
nt Neutral Zone
nu Niue
nz New Zealand
om Oman
org Non-Profit Making Organisations (sic)
pa Panama
pe Peru
pf Polynesia (French)
pg Papua New Guinea
ph Philippines
pk Pakistan
pl Poland
pm Saint Pierre and Miquelon
pn Pitcairn Island
pr Puerto Rico
pt Portugal
pw Palau
py Paraguay
qa Qatar
re Reunion (French)
ro Romania
ru Russian Federation
rw Rwanda
sa Saudi Arabia
sb Solomon Islands
sc Seychelles
sd Sudan
se Sweden
sg Singapore
sh Saint Helena
si Slovenia
sj Svalbard and Jan Mayen Islands
sk Slovak Republic
sl Sierra Leone
sm San Marino
sn Senegal
so Somalia
sr Suriname
st Saint Tome (Sao Tome) and Principe
su Former USSR
sv El Salvador
sy Syria
sz Swaziland
tc Turks and Caicos Islands
td Chad
tf French Southern Territories
tg Togo
th Thailand
tj Tadjikistan
tk Tokelau
tm Turkmenistan
tn Tunisia
to Tonga
tp East Timor
tr Turkey
tt Trinidad and Tobago
tv Tuvalu
tw Taiwan
tz Tanzania
ua Ukraine
ug Uganda
uk United Kingdom
um USA Minor Outlying Islands
us United States
uy Uruguay
uz Uzbekistan
va Holy See (Vatican City State)
vc Saint Vincent & Grenadines
ve Venezuela
vg Virgin Islands (British)
vi Virgin Islands (USA)
vn Vietnam
vu Vanuatu
wf Wallis and Futuna Islands
ws Samoa
ye Yemen
yt Mayotte
yu Yugoslavia
za South Africa
zm Zambia
zr Zaire
zw Zimbabwe

// Vladimirr

Udgivet i Knowledge Base, Old Base | Skriv en kommentar

Create colorized HTML files from your source code files with VIM

Open your source code file with VIM and type ‘:ru syntax/2html.vim’ in command mode.

And poof, there we have another window with your HTML converted source code.

Enjoy 😉

/secor

Udgivet i Knowledge Base, Old Base, Programmering, Vim | Skriv en kommentar

Create colorized HTML files from your source code files with VIM

Open your source code file with VIM and type ':ru syntax/2html.vim' in command mode.

And poof, there we have another window with your HTML converted source code.


Enjoy ;)


/secor
Udgivet i Knowledge Base, Vim | Skriv en kommentar

Creating users in mysql

root@chilibeans:~# mysql -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4023 to server version: 3.23.54

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database queze;
Query OK, 1 row affected (0.03 sec)

mysql> grant all privileges on queze.* to queze@localhost identified by "*****";
Query OK, 0 rows affected (0.01 sec)

 

Udgivet i Knowledge Base, Old Base, SQL | Skriv en kommentar

Making swapfile in Linux

dd if=/dev/zero of=/swap bs=1024 count=512k
mkswap /swap
swapon /swap

Dette skriver 1024 tegn til filen 512.000 gange.
Det vil sige at der bliver lavet en swapfil på 512Mb.

Udgivet i Knowledge Base, Linux, Old Base | Skriv en kommentar

PPPoE router (natd) in FreeBSD

TDC ADSL PPPoE router in FreeBSD (with firewall (ipfw) and routing (natd))


  To run a router it's recommended that the router has two NIC's.
  Remember to configure the LAN-NIC in /etc/rc.conf



  First your kernel needs some options:

options   IPFIREWALL
options   IPFIREWALL_VERBOSE
options   IPFIREWALL_DEFAULT_TO_ACCEPT
options   IPFIREWALL_FORWARD

options   IPDIVERT
options   DUMMYNET

options NETGRAPH
options NETGRAPH_ETHER
options NETGRAPH_PPPOE
options NETGRAPH_SOCKET


  I don't know if they all are necessary but use it if in doubt. It works for me.

  Now you need to edit your /etc/ppp/ppp.conf to look like this:

default:
 set log Phase Chat IPCP CCP tun command
 set redial 15 28800
 set reconnect 15 28800

tdc:
 set device PPPoE:rl0:
 disable acfcomp protocomp
 deny acfcomp
 set mtu max 1492
 set speed sync
 enable lqr
 set lqrperiod 5
 set cd 5
 set dial
 set login
 set timeout 0
 set authname USERNAME
 set authkey PASSWORD
 add! default HISADDR
 enable dns
 enable mssfixup


  Remember to change the device in the line "set device PPPoE:rl0:"
  I use a Realtek 8139 based NIC for my connection, therefor the "rl0"

  So, the kernel and ppp.conf has been configured, now we need to change/add
  some stuff in /etc/rc.conf so the connection will be up and running when booting:

ifconfig_rl0="up"
ppp_mode="ddial"
ppp_profile="tdc"
ppp_enable="YES"

  Remember to change the "ifconfig_rl0="up"" if needed.

  To share the connection the next lines should be added to rc.conf too:

gateway_enable="YES"			# Activate gateway
natd_enable="YES"                       # Activate natd
natd_flags="-dynamic"			# flags for the natd command
natd_interface="tun0"                   # Interface to nat on
ppp_nat="NO"				# Make sure that ppp doesn't nat


  If you want a firewall (yes you do!) the next lines should also be added to /etc/rc.conf:

firewall_enable="YES"
firewall_script="/etc/ipfw.sh"


  Change "firewall_script="/etc/ipfw.sh"" to your own firewallscript.

  Now, the firewallscript should be made. Here's an example of my firewallscript:

### Variables: ###
# Let's start with defining som variables:

# Internal NIC:
 INT_NIC="xl0"

# External NIC:
 EXT_NIC="tun0"

# Link to ipfw-binary:
 FWBIN="/sbin/ipfw"

### The script: ###

# Flush all rules:
 $FWBIN -f flush

 $FWBIN add divert natd all from any to any via tun0

# Let's allow everything trough localhost and the internal NIC.
 $FWBIN add allow ip from any to any via lo0
 $FWBIN add allow ip from any to any via $INT_NIC

# Let's allow all connections that the internal network creates:
 $FWBIN add allow tcp from 192.168.0.0/24 to any out via $EXT_NIC keep-state
 $FWBIN add allow tcp from me to any out via $EXT_NIC

# Let's allow all ICMP-thingies:
 $FWBIN add allow icmp from any to any via $EXT_NIC

# Let's allow all established connections:
  $FWBIN add allow tcp from any to any established

# Block filesharing:
 $FWBIN add deny tcp from any to me 135-139 in via $EXT_NIC
 $FWBIN add deny udp from any to me 135-139 in via $EXT_NIC
 $FWBIN add deny tcp from any to me 445 in via $EXT_NIC
 $FWBIN add deny udp from any to me 445 in via $EXT_NIC

# Allow all udp-packages:
 $FWBIN add allow udp from any to any

# Ports which should be allowed through the $EXT_NIC to the server:
 $FWBIN add allow tcp from any to me 21 in via $EXT_NIC setup
 $FWBIN add allow tcp from any to me 22 in via $EXT_NIC setup
 $FWBIN add allow tcp from any to me 25 in via $EXT_NIC setup
 $FWBIN add allow tcp from any to me 80 in via $EXT_NIC setup
 $FWBIN add allow tcp from any to me 113 in via $EXT_NIC setup
 $FWBIN add allow tcp from any to me 1243 in via $EXT_NIC setup
 $FWBIN add allow tcp from any to me 6667-6669 in via $EXT_NIC setup
 $FWBIN add allow tcp from any to me 49100-65535 in via $EXT_NIC setup

# Ports which should be forwarded to a another box on the LAN:

# Deny the rest:
 $FWBIN add 65000 deny log ip from any to any



  Remeber to change stuff in this firewallscript to match your configuration.
  If everything is ok, you should be ready to reboot

 

Udgivet i FreeBSD, Knowledge Base, Networking, Old Base, Uncategorized | Skriv en kommentar

Taking command line arguments in C

bash$ cat vladimirr.c 
int main(argc, argv)
int argc;
char **argv;
{
int i;
for (i=0; i<=argc; i++)
{
printf("Argument[%i]=%s\n",i,argv[i]);
}
}

bash$ cc vladimirr.c -o vladimirr
bash$ ./vladimirr er en gammel torsk som stinker til c
Argument[0]=./vladimirr
Argument[1]=er
Argument[2]=en
Argument[3]=gammel
Argument[4]=torsk
Argument[5]=som
Argument[6]=stinker
Argument[7]=til
Argument[8]=c
Argument[9]=(null)


Dedikeret til vores alles elskede vladimirr :)

 

Udgivet i Knowledge Base, Old Base, Programmering | Skriv en kommentar

Editing your menu in BlackBox on freebsd

You need the edit the file /usr/X11R6/share/blackbox/menu to change your menu layout.
The menu file is pretty easy to understand 🙂

The file is found somewhere else on a linux system.

// Vladimirr.dk

Udgivet i Knowledge Base, Old Base, Workstation | Skriv en kommentar

Preload of images with JS

Unifix knowledge database – The original one
Dashboard – News – Search – List – About – Admin

Preload of images with JS
Author:vladimirr – Thu Aug 7 20:36:03 2003

<script language=”JavaScript”>
<!–
function PreLoad() {
if (document.images) {

img1 = new Image();
img1.src = “billede1.jpg”;

img2 = new Image();
img2.src = “billede2.gif”;

img3 = new Image();
img3.src = “billede3.jpg”;

}
}
//–>
</script>

Add the pictures above and place it in your <head> section of the website
(remeber to change the numbers)

Use <body onLoad=”PreLoad();”> to start the preloading on the site

// Vladimirr.dk

Udgivet i Knowledge Base, Old Base, Programmering, Uncategorized | Skriv en kommentar