giovedì 20 maggio 2010
Create empty file in UNIX
dd if=/dev/urandom of=yourfilename bs=1M count=100
or
SOLARIS
dd if=/dev/urandom of=yourfilename bs=1 count=100
lunedì 22 marzo 2010
Compact Flash cards Speeds
Card speed is usually specified in "x" ratings, e.g. 8x, 20x, 133x. This is the same system used for CD-ROMs and gives the data rate as a multiple of the data rate of the first CD-ROMs (i.e. the data rate of an audio CD). The base rate is 150 kB/s, so for example, 20x = 20 * 150 kB/s = 3.0 MB/s.
The following table lists some common ratings and their respective maximum transfer rates.
Rating Speed (MB/s)
6x 0.9
32x 4.8
40x 6.0
66x 10.0
100x 15.0
133x 20.0
150x 22.5
200x 30.0 EXTREME3
266x 40.0 EXTREME4
280x 42.0
300x 45.0
333x 50.0
400x 60.0
433x 65.0
600x 90.0 UDMA
667x 100.0
mercoledì 17 marzo 2010
FireFox keeps asking for Proxy Authentication
set the pref network.auth.force-generic-ntlm set to “true” in the following file:
c:\program files\mozilla firefox\greprefs\all.js
Restart Firefox
sabato 6 marzo 2010
UBUNTU 9.10 resolution problems solved.
- Resetting an out-of-range resolution
- Dynamically testing different resolutions
- Adding undetected resolutions
- Setting xrandr changes persistently
- Obtaining modelines from Windows program PowerStrip
The fastway.
cvt 1280 1024# 1280x1024 59.89 Hz (CVT 1.31M4) hsync: 63.67 kHz; pclk: 109.00 MHz
Modeline "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
xrandr --newmode "1280x1024_60.00" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
xrandr --addmode VGA1 1280x1024_60.00
xrandr --output VGA1 --mode 1280x1024_60.00
Resetting an out-of-range resolution
If you set a resolution inappropriate for your monitor in the Screen Resolution GUI tool, you can reset it by running rm ~/.config/monitors.xml from a terminal.
Dynamically testing different resolutions
You can either use the Screen Resolution GUI tool to experiment with different resolutions, or the more powerful xrandr command-line tool:
$ xrandr
shows you the names of different outputs available on your system (LVDS, VGA-0, etc.) and resolutions available on each:
Screen 0: minimum 320 x 200, current 1400 x 1050, maximum 1400 x 1400
VGA disconnected (normal left inverted right x axis y axis)
LVDS connected 1400x1050+0+0 (normal left inverted right x axis y axis) 286mm x 214mm
1400x1050 60.0*+ 50.0
[...]
You can direct xrandr to set a different resolution like this:
$ xrandr --output LVDS --mode 1024x768
The refresh rate may also be changed, either at the same time or independently:
$ xrandr --output LVDS --mode 1024x768 --rate 75
Note that changes you make using xrandr only last through the current session. xrandr has a lot more capabilities - see man xrandr for details.
Adding undetected resolutions
Due to buggy hardware or drivers, your monitor's correct resolutions may not always be detected. For example, the EDID data block queried from your monitor may be incorrect.
If the mode already exists, but just isn't associated for the particular output, you can add it like this:
$ xrandr --addmode S-video 800x600
If the mode doesn't yet exist, you'll need to create it first by specifying a modeline:
$ xrandr --newmode
You may create a modeline using the gtf or cvt utility. For example, if you want to add a mode with resolution 800x600, you can enter the following command: (The output is shown following.)
$ cvt 800 600
# 800x600 59.86 Hz (CVT 0.48M3) hsync: 37.35 kHz; pclk: 38.25 MHz
Modeline "800x600_60.00" 38.25 800 832 912 1024 600 603 607 624 -hsync +vsync
Then copy the information after the word "Modeline" into the xrandr command:
$ xrandr --newmode "800x600_60.00" 38.25 800 832 912 1024 600 603 607 624 -hsync +vsync
Setting xrandr changes persistently
There are several ways to make xrandr customizations permanent from session to session: a) .xprofile, b) kdm/gdm, c) xorg.conf. Each of these mechanisms will be discussed in turn.
Setting xrandr commands in .xprofile
A user's ~/.xprofile file is executed on Xorg startup if it exists and is executable. You can copy and paste xrandr command line strings into this file so they're executed when you log in. For example:
$ xrandr --output VGA-0 --mode 800x600
There are two disadvantages to using .xprofile for xrandr settings. First, it occurs fairly late in the startup process, so you'll see some resolution resizing during the initial screen draw; in some cases panel windows may resize improperly as a result. Second, as this is a per-user setting, it won't affect the resolutions of other users, nor will it alter the resolution on the login screen.
Setting xrandr commands in kdm/gdm startup scripts
Both KDM and GDM have startup scripts that are executed when X is initiated. For GDM, these are in /etc/gdm/ , while for KDM this is done at /etc/kde4/kdm/Xsetup. In either case, you can paste in an xrandr command line string into one of these scripts. For GDM, try putting them right before initctl -q emit login-session-start DISPLAY_MANAGER=gdm in /etc/gdm/Init/Default
This process requires root access and mucking around in system config files, but will take effect earlier in the startup process than using .xprofile, and will apply to all users including the login screen.
Setting resolution changes in xorg.conf
While xorg.conf is largely empty these days, it can still be used for setting up resolutions. For example:
Section "Monitor"
Identifier "External DVI"
Modeline "1280x1024_60.00" 108.88 1280 1360 1496 1712 1024 1025 1028 1060 -HSync +Vsync
Option "PreferredMode" "1280x1024_60.00"
EndSection
Section "Device"
Identifier "ATI Technologies, Inc. M22 [Radeon Mobility M300]"
Driver "ati"
Option "Monitor-DVI-0" "External DVI"
EndSection
Section "Screen"
Identifier "Primary Screen"
Device "ATI Technologies, Inc. M22 [Radeon Mobility M300]"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1280x1024" "1024x768" "640x480"
EndSubSection
EndSection
Section "ServerLayout"
Identifier "Default Layout"
Screen "Primary Screen"
EndSection
See man xorg.conf for full details on how to craft an xorg.conf file.
Setting resolution changes in xorg.conf -- resolution lower than expected
Try this first
If you video card is recognized but the resolution is lower than you expect, you may try this.
Background: I use Ubuntu 9.0.4 x86, ATI X1550 based video card and two LCD monitors DELL 2408(up to 1920x1200) and Samsung 206BW(up to 1680x1050). Upon first login after installation, the resolution default to 1152x864. xrandr does not list any resolution higher than 1152x864. You may want to try editing /etc/X11/xorg.conf, add a section about virtual screen, logout, login and see if this helps. If not then read on.
Change the default xorg.conf
Section "Device"
Identifier "Configured Video Device"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
EndSection
To
Section "Monitor"
Identifier "Configured Monitor"
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
-> SubSection "Display"
-> Virtual 3600 1200
-> EndSubSection
EndSection
Section "Device"
Identifier "Configured Video Device"
EndSection
About the numbers: I put DELL on the left and Samsung on the right. So the virtual width is of sum of both LCD width 3600=1920+1680; Height then is figured as the max of them, which is max(1200,1050)=1200. If you put one LCD above the other, use this calculation instead: (max(width1, width2), height1+height2).
If that does not help, here's what I did:
Use cvt/xrandr tool to add the highest mode the LCD can do
The actual order was different, as I tried to add new mode to one LCD at a time. Below is the combined/all-in-one quote
aa@aa-desktop:/$ cvt 1920 1200 60
# 1920x1200 59.88 Hz (CVT 2.30MA) hsync: 74.56 kHz; pclk: 193.25 MHz
Modeline "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
aa@aa-desktop:/$ cvt 1680 1050 60
# 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
Modeline "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
aa@aa-desktop:/$ xrandr --newmode "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync
aa@aa-desktop:/$ xrandr --newmode "1680x1050_60.00" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync
aa@aa-desktop:/$ xrandr --addmode DVI-1 "1920x1200_60.00"
aa@aa-desktop:/$ xrandr --addmode DVI-0 "1680x1050_60.00"
Preference -> Display">Goto Ubuntu Menu: System -> Preference -> Display
Change one of the LCD's resolution to a lower one, e.g. 800x600. Apply change, then (I don't remember the exact order/wording here:) hopefully the GUI will give you a prompt saying something like "the resolution can be improved but virtual screen has to be enabled, you need to however logout and log back in". I did it and on 2nd login, I am able to find the higher resolution listed for that LCD. After that I follow suite and make similar change to 2nd LCD and am able to get both of them working.giovedì 4 marzo 2010
Add user ti SUDO
To give a user the ability to use the “sudo” command you must add them to the “sudoers” file. Here’s how. Thanks to ubuntucat (see comment below) for the following suggestion! The easiest way to allow a user to sudo is to simply run the following command from the Terminal:
To open the Terminal:
Applications >> Accessories >> Terminal
Once the Terminal is open type:
sudo adduser username admin
This must be done from an account that already has sudo abilities or else from the root account.
If for some reason you have to manually edit the “sudoers” file keep reading!
Open the file “sudoers” located at /etc/sudoers using your favorite text editor. You must have root permissions to be able to edit this file so you will want to open your editor from the command line.
To use gedit you would do the following:
Open the Terminal and type:
sudo gedit /etc/sudoers
If you want to use vim you can simply enter the following into the Terminal:
sudo visudo
Once you have the sudoers file open, scroll down to the line:
root ALL = (ALL) ALL
Add the folling line below the root line (replacing “user” with the name of the account you wish to give sudo access to)
user ALL = (ALL) ALL
Save and close the file. The new user has now been added to the “sudoers” file and can use the “sudo” command.
Nagios Ubuntu Install
Introduction
This guide is intended to provide you with simple instructions on how to install Nagios from source (code) on Ubuntu and have it monitoring your local machine inside of 20 minutes. No advanced installation options are discussed here - just the basics that will work for 95% of users who want to get started.
These instructions were written based on an Ubuntu 6.10 (desktop) installation. They should work for an Ubuntu 7.10 install as well.
What You'll End Up With
If you follow these instructions, here's what you'll end up with:
- Nagios and the plugins will be installed underneath /usr/local/nagios
- Nagios will be configured to monitor a few aspects of your local system (CPU load, disk usage, etc.)
- The Nagios web interface will be accessible at http://localhost/nagios/
Required Packages
Make sure you've installed the following packages on your Ubuntu installation before continuing.
- Apache 2
- PHP
- GCC compiler and development libraries
- GD development libraries
You can use apt-get to install these packages by running the following commands:
sudo apt-get install apache2
sudo apt-get install libapache2-mod-php5
sudo apt-get install build-essential
With Ubuntu 6.10, install the gd2 library with this command:
sudo apt-get install libgd2-dev
With Ubuntu 7.10, the gd2 library name has changed, so you'll need to use the following:
sudo apt-get install libgd2-xpm-dev
1) Create Account Information
Become the root user.
sudo -s
Create a new nagios user account and give it a password.
/usr/sbin/useradd -m -s /bin/bash nagios
passwd nagios
On older Ubuntu server editions (6.01 and earlier), you will need to also add a nagios group (it's not created by default). You should be able to skip this step on desktop, or newer server editions of Ubuntu.
/usr/sbin/groupadd nagios
/usr/sbin/usermod -G nagios nagios
Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.
/usr/sbin/groupadd nagcmd
/usr/sbin/usermod -a -G nagcmd nagios
/usr/sbin/usermod -a -G nagcmd www-data
2) Download Nagios and the Plugins
Create a directory for storing the downloads.
mkdir ~/downloads
cd ~/downloads
Download the source code tarballs of both Nagios and the Nagios plugins (visit http://www.nagios.org/download/ for links to the latest versions). These directions were tested with Nagios 3.1.1 and Nagios Plugins 1.4.11.
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz
3) Compile and Install Nagios
Extract the Nagios source code tarball.
cd ~/downloads
tar xzf nagios-3.2.0.tar.gz
cd nagios-3.2.0
Run the Nagios configure script, passing the name of the group you created earlier like so:
./configure --with-command-group=nagcmd
Compile the Nagios source code.
make all
Install binaries, init script, sample config files and set permissions on the external command directory.
make install
make install-init
make install-config
make install-commandmode
Don't start Nagios yet - there's still more that needs to be done...
4) Customize Configuration
Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios. You'll need to make just one change before you proceed...
Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you'd like to use for receiving alerts.
vi /usr/local/nagios/etc/objects/contacts.cfg
5) Configure the Web Interface
Install the Nagios web config file in the Apache conf.d directory.
make install-webconf
Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account - you'll need it later.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Restart Apache to make the new settings take effect.
/etc/init.d/apache2 reload
Note: Consider implementing the ehanced CGI security measures described here to ensure that your web authentication credentials are not compromised.
6) Compile and Install the Nagios Plugins
Extract the Nagios plugins source code tarball.
cd ~/downloads
tar xzf nagios-plugins-1.4.11.tar.gz
cd nagios-plugins-1.4.11
Compile and install the plugins.
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
7) Start Nagios
Configure Nagios to automatically start when the system boots.
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
Verify the sample Nagios configuration files.
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are no errors, start Nagios.
/etc/init.d/nagios start
8) Login to the Web Interface
You should now be able to access the Nagios web interface at the URL below. You'll be prompted for the username (nagiosadmin) and password you specified earlier.
http://localhost/nagios/
Click on the "Service Detail" navbar link to see details of what's being monitored on your local machine. It will take a few minutes for Nagios to check all the services associated with your machine, as the checks are spread out over time.
9) Other Modifications
If you want to receive email notifications for Nagios alerts, you need to install the mailx (Postfix) package.
sudo apt-get install mailx
sudo apt-get install postfix
You'll have to edit the Nagios email notification commands found in /usr/local/nagios/etc/objects/commands.cfg and change any '/bin/mail' references to '/usr/bin/mail'. Once you do that you'll need to restart Nagios to make the configuration changes live.
sudo /etc/init.d/nagios restart
Configuring email notifications is outside the scope of this documentation. Refer to your system documentation, search the web, or look to the Nagios Support Portal or Nagios Community Wiki for specific instructions on configuring your Ubuntu system to send email messages to external addresses.
mercoledì 27 gennaio 2010
Configure a Management Interface for 3550 and 3750 Series Switches
Option 1—Configure a loopback interface for switch management. There are a few advantages to a loopback interface. A loopback is a virtual interface that is always up. Packets that are routed to the loopback interface are rerouted back to the L3 switch or router and processed locally. IP packets that are routed out the loopback interface but are not destined to the loopback interface are dropped. This means that the loopback interface serves as the null 0 interface also. The loopback interface serves as the router ID for OSPF and so on. This example uses loopback 0:
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface loopback 0
Switch(config-if)#ip address 10.1.1.1 255.255.255.255
!--- The loopback interface should have a 32-bit subnet mask, which means that
!--- the 10.1.1.1 address is the only destination address in this subnet.
Switch(config-if)#end
Switch#
You must also configure a routing protocol to distribute the subnet that is assigned to the loopback address or create a static route.
Option 2—Configure the interface as an L3 routed interface with an IP address. All interfaces on a Catalyst 3550 or 3750 switch that runs Cisco IOS Software are L2 by default. In order to make an L2 interface an L3 interface, issue the no switchport command and then configure an IP address. All interfaces are enabled by default, so you do not need to issue the no shutdown command. This example uses Fast Ethernet 2/0/1 on a Catalyst 3750:
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface fastethernet 2/0/1
Switch(config-if)#no switchport
Switch(config-if)#ip address 11.1.1.1 255.0.0.0
Switch(config-if)#end
Switch#
If you issue the show running-config interface fastethernet 2/0/1 command, this output displays:
Switch#show running-config interface fastethernet 2/0/1
Building configuration...
Current configuration : 81 bytes
!
interface FastEthernet2/0/1
no switchport
ip address 11.1.1.1 255.0.0.0
end
Switch#
Option 3—Configure an L2 interface as a part of a specific VLAN. Issue the switchport mode access command and the switchport access vlan vlan-id command, and use a corresponding SVI with an IP address.
Complete these steps:
-
Issue these commands:
Switch(config)#interface vlan 1
!--- Interface VLAN 1 is an SVI.
Switch(config-if)#ip address 10.1.1.1 255.0.0.0
Switch(config-if)#no shutNote: This example uses VLAN 1 as the management VLAN. VLAN 1 is in the VLAN database by default.
-
Issue the switchport mode access command under the desired physical interface if you want confirmation that the interface is an access switch port.
By default, all interfaces are L2 interfaces and are access switch ports in VLAN 1. If you plan to use VLAN 1 as the management VLAN, no configuration is necessary under the interface. But if you want confirmation in the configuration that the interface is indeed an access switch port, you need to use the switchport mode access command.
This example uses Fast Ethernet 2/0/1:
Switch(config)#interface fastethernet 2/0/1
Switch(config-if)#switchport mode access
Switch(config-if)#endIf you issue the show run interface fastethernet 2/0/1 command, this output now displays:
Switch#show run interface fastethernet 2/0/1
Building configuration...
Current configuration : 59 bytes
!
interface FastEthernet2/0/1
switchport mode access
end
Switch# -
If you want to change the management interface from the default VLAN 1 to another VLAN, issue the interface vlan vlan-id command in order to create a new SVI.
You must then issue the switchport access vlan vlan-id command in order to configure an L2 interface to be a part of the new VLAN. This example demonstrates this process:
Switch(config)#interface vlan 2
Switch(config-if)#ip address 20.1.1.1 255.0.0.0
Switch(config-if)#no shut
!--- Configure an interface to access the new management VLAN.
Switch(config)#interface fastethernet 2/0/1
Switch(config-if)#switchport access vlan 2
Switch(config-if)#end
Switch#If you issue the show run interface fastethernet 2/0/1 command, this output now displays:
Switch#show run interface fastethernet 2/0/1
Building configuration...
Current configuration : 85 bytes
!
interface FastEthernet2/0/1
switchport access vlan 2
switchport mode access
end
Switch#In order for the switch to access remote networks, you must have either:
-
A default gateway that is set for the next hop router that is directly connected to the switch
-
A dynamic routing protocol configured
If you are not routing IP, issue the ip default-gateway ip-address command in order to configure a gateway router IP address.
If you plan to configure dynamic routing, keep in mind that IP routing is disabled by default. You must issue the global ip routing command in order to enable IP routing. Routing Information Protocol (RIP) is the only dynamic routing protocol that is supported when you use the Standard Multilayer Software Image (SMI). The Enhanced Multilayer Software Image (EMI) is required for Interior Gateway Routing Protocol (IGRP), Enhanced IGRP (EIGRP), OSPF, and Border Gateway Protocol (BGP) support. In order to configure dynamic routing, use the router routing_protocol command. Issue the show ip route command in order to view the status of the routing table.
-
Catalyst 2900-XL and 3500-XL Password Recovery Procedure
Description
This document describes the password recovery procedure for the Cisco Catalyst 2900-XL and the Cisco Catalyst 3500-XL.
Step-by-Step Procedure
Attach a terminal or PC with terminal emulation to the console port of the switch. Use the following terminal settings:
9600 baud rate
No parity
8 data bits
No stop bit
- Unplug the power cable.
- Hold down the mode button while reconnecting the power cord to the switch. You can release the mode button a second or two after the LED above port 1x is no longer illuminated.
The following instructions appear:
The system has been interrupted prior to initializing the flash file system.
The following commands will initialize the flash file system, and finish loading
the operating system software:
flash_init
load_helper
boot- Type flash_init.
- Type load_helper.
- Type dir flash:.
The switch file system is displayed:
Directory of flash:
2 -rwx 843947 Mar 01 1993 00:02:18 C2900XL-h-mz-112.8-SA
4 drwx 3776 Mar 01 1993 01:23:24 html
66 -rwx 130 Jan 01 1970 00:01:19 env_vars
68 -rwx 1296 Mar 01 1993 06:55:51 config.text
1728000 bytes total (456704 bytes free)- Type rename flash:config.text flash:config.old to rename the configuration file.
This file contains the password definition.
- Type boot to boot the system.
- Enter N at the prompt to start the Setup program, Continue with the configuration dialog? [yes/no] : N
- At the switch prompt type en to turn on enable mode.
- Type rename flash:config.old flash:config.text to rename the configuration file with its original name.
- Copy the configuration file into memory:
Switch# copy flash:config.text system:running-config
Source filename [config.text]? (press Return)
Destination filename [running-config]? (press Return)The configuration file is now reloaded.
- Change the password:
switch#configure terminal
switch(config)#enable password Cisco
switch#control/ZWrite the running configuration to the configuration file:
switch(config)#write memory
martedì 26 gennaio 2010
Proxy Problem WINDOWS 7
"The problem is the autentificación NTLM of Windows7. It is necessary to create the following key in the registry to solve it (I'm using Squid Version 3.0.STABLE8 in Debian Lenny):
1. In HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
If it doesn’t exist, create a DWORD value named LmCompatibilityLevel and set the value to 1 to use LM NTLM and NTLMv2 if is negociated, this is
Also it works establishing the value to 0, and 3 though for more safety the value using 3 though with old operating systems it will not work on having used obligatorily NTLMv2.
2. Reboot
To follow the link for more information: http://technet.microsoft.com/es-es/magazine/2006.08.securitywatch(en-us).aspx"
Source: http://www.nabble.com/Windows-7-beta-and-NTLM-td21377271.html
This worked well, now I'm able to connect in internet through proxy server.
Thanks