Linux
PREVIOUS
NEXT
Determine Linux ethernet interface speed and duplex
Determine the autonegotiated ethernet connection speed and duplex using the mii-tool commandRunning the following command as superuser with no options will generate basic information about all of the ethernet interfaces on the computer:
mii-tool
The resulting output will look something like:
eth0: negotiated 100baseTx-FD, link ok
This output shows one interface (eth0) which was autonegotiated to 100 Mbps (100baseTx) and full duplex (FD).
Adding the -v option to the command generates verbose output and will tell you more about the interface including the manufacturer and model (if available) and the interface's capabilities.... Read More
Force the speed and duplex of a Linux ethernet interface
Using mii-tool, the speed and duplex of an ethernet interface can be set manually.You must set both the speed and duplex at the same time (it is not possible to autonegotiate only one). Typical combinations are:
100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
To set 100 Mbps and full duplex on interface eth0, for example, use:
mii-tool -F 100baseTx-FD eth0... Read More
RedHat Linux IP Forwarding
To enable IP (IPv4) Forwarding in RedHat linux.To enable IP forwarding temporarily (until the next reboot):
echo 1 > /proc/sys/net/ipv4/ip_forward
To enable permanently, edit /etc/sysconfig/network and change or add the following line:
FORWARD_IPV4 = YES... Read More
Disable ICMP echo (ping) responses in Linux
Many malicious attacks begin with a ping scan. Disabling ICMP echo requests prevents your system's discovery with a ping.As superuser, add the following lines to /etc/sysctl.conf
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_echo_ignore_all = 1
Then run the following command to cause the change to take effect immediately:
sysctl -p
This change will persist following a reboot.... Read More
Hide your BIND version
Any user can discover the version of bind you are running with the following command: nslookup -q=txt -class=CHAOS version.bin.remote.dns.serverTo hide your version of bind, add the following value to named.conf
version "[SECURED]" in the options section section as follows:
options {
directory "/var/named";
version "[SECURED]";
};
and restarted named.... Read More
Make Linux ignore a ping
Sometimes it can be useful to hide a Linux machine a bit.To turn answers to icmp_echos off, as root type:
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
and to turn it on again type:
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all... Read More
Apache-Website Security
Simple clear Security for Websites running on Apache. This can be on any flavor of UnixIn the httpd.conf file edit this line:
Directory /
Options FollowSymLinks
AllowOverride None
/Directory
To read:
Directory /
Options FollowSymLinks
AllowOverride AuthConfig
/Directory
**note** -the above lines have <> on each side of the Directory statement. This form would not accept the brackets. **end Note**
go to serverroot/bin and run the command:
htpasswd -c /password example test
-this creates the password file. It will prompt for new password expample. testpassword
*****Remember****** must make password file executable. You can find it in / .
then create a file named .htaccess that reads:
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /password
Require user test
Now when you hit the website or the files in the directory you want to secure it will prompt you for the test username and the password that you created. This is clear text so be careful. More than one name can be used by usi... Read More
KDE: Quick Way to Change or Install New Icons
How to install new icon packs or change existing icons in KDE without using the Kcontrol command.1. Right click on your desktop
2. Click on Run Command...
3. Type in Icons and click on Run
If you want to install a new theme then click on the "Install New Theme ..." button. Choose the location and click on OK. Then to apply the theme just click on OK in the "Configure- KDE Control Module" window.
To change the properties of the existing icons go to the Advanced tab in the "Configure- KDE Control Module" window. Here you can change the size, effects etc for the existing icons.... Read More
Linux RAID - recreate from scratch
How to recreate the raid devices on a Linux system if you are booting from rescue media or alternate system (such as a CDROM based distro like Knoppix).I recently had to boot a system from alternate media to repair some configuration problems on the system. The disks are LVM on top of software RAID 1. The rescue media didn't detect or recreate the RAID devices so the LVM volumes (and thus the system data) were not available.
To recreate the RAID partition, use the mdadm command like this (only do this if /etc/mdadm/mdadm.conf is empty or isn't working).
echo DEVICE partitions > /etc/mdadm/mdadm.conf
/sbin/mdadm --examine --scan >> /etc/mdadm/mdadm.conf
/sbin/mdadm --assemble --scan
Then, LVM will work with just a couple more commands. Note that vgscan writes the lvmtab files to /etc and about 500KB per volume group will be required. This was an issue on my Knoppix 3.2 rescue platform.
vgscan
vgchange -ay
To list the logical volumes use
sudo /usr/sbin/lvm lvscan
Then you can mo... Read More
Extract a gzip compressed tar archive in Linux
The version of tar in most Linux distributions supports gzip compression. This means that a gzipped tar file can be extracted in one simple command.To extract the archive filename.tar.gz into the current directory:
tar xzf filename.tar.gz
If this fails, the version of tar may not support gzip compression. In this case, you can use the traditional two-stage command:
gzip -dc filename.tar.gz | tar xf -... Read More
Reconfiguration boot in RedHat Linux
If new hardware is not recognized, a reconfiguration boot might help. During the reconfiguration boot, the anaconda hardware configuration program is run with the --reconfig option.To perform a reconfiguration boot, create an empty file called /etc/reconfigSys:
touch /etc/reconfigSys
and reboot the system.... Read More
List files in an RPM package
RPM is a popular software packaging format. Originally named as Red Hat Package Manager as it was developed by Red Hat for their linux distribution. Since then it has been ported to more that 20 operating systems. If you have an RPM file, the only way to get its contents out is to use the rpm utility. This recipe describes how to list the files contained in an RPM. To be honest, I don't do this often enough to remember the simple command and always have to go through the really big man page to figure it out again.To list the contents of the RPM techrx.rpm use this command:
rpm -qlp techrx.rpm... Read More
Safely reboot a Linux system
The proper method of rebooting a Linux system ensures data integrity by terminating processes and synchronizing the filesystems.To reboot a Linux system:
shutdown -r
To reboot immediately, specify the command with the now option:
shutdown -r now... Read More
Convert Unix lines breaks to Macintosh line breaks
This one liner will convert Unix line breaks to Macintosh lines breaks in a text file
tr '\012' '\015' < unix-format-file > mac-friendly-file... Read More
Build from RedHat source package (.src)
Build binary packages from src packages with pkgbuild. Better performance and easy to do!If you have used RedHat Linux (or other package-based distributions), I'm sure you have used .rpm (RedHat Package Manager) packages. You may have noticed i386, i486, i586, i686, or athlon lurking in the filename as well. This notation refers to the processor type (architecture) the package was built to support.
Sometimes, you cannot find a package to match your architecture, however. You can use a lower-numbered package, or try building!
In this example, I will use the fictional 'noname' package. Also, replace 'i686' with an appropriate architecture.
As root, or sudo:
rpmbuild --target i686 --rebuild noname-0.0.1.src.rpm
Go get a cup of coffee. This process may take a while, depending on the package. This process involves installing the src package to /usr/src/redhat/SOURCES, running configure, and running make.
Look in /usr/src/redhat/RPMS/i686 for the completed binary .rpm package. These packages... Read More
Dial up and start Mozilla in one click
Set up a desktop icon under KDE that will both make your modem dial into the Internet and also start Mozilla, all with a single click.You can easily set up a desktop icon that will make your modem dial into the Internet and also start Mozilla. To do so, you must first create an "Autodial" kppp account to run Mozilla, and then create a desktop icon that will use it.
Please note that this How-To assumes you can already get your modem to connect to the Internet, and that you can then run Mozilla successfully.
First, to create an "Autodial" kppp account:
Open the KPPP window
In the KPPP window, click on the Setup button, click on the account you normally use to connect to the Internet, and then click on the Copy button
Click on the new account (which should have a name ending in "_copy") and click on the Edit... button to open the Edit Account window
Change the Connection Name to Autodial
Click on the Execute tab, and in the Upon connect: field put /usr/bin/mozilla
Finally, close the KPPP ... Read More
Determine Linux version
When visiting a new Linux system, it may not be known which of the many flavors and versions the system is. This recipe describes a couple of techniques for determining the version of Linux running on a host.The command uname -a will generate output like
Linux poly.tech-recipes.com 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 i686 i386 GNU/Linux
This can be interpreted as:
kernel name: Linux
hostname: poly.tech-recipes.com
kernel release: 2.6.5-1.358
kernel version: #1 Sat May 8 09:04:50 EDT 2004
The specific distribution information is missing from the uname output. Many distributions put this information in a file in /etc like /etc/redhat-release, /etc/debian_version, /etc/gentoo-release, and so on. For the system described by the uname output above, the file /etc/fedora-release contains the following text:
Fedora Core release 2 (Tettnang)... Read More
Mount an ISO file in Linux
It is convenient to mount an ISO file directly instead of burning it to a CD first. This recipe describes the command used to mount an ISO image on a Linux system.To mount the ISO image file.iso to the mount point /mnt/test use this command:
mount -o loop -t iso9660 file.iso /mnt/test... Read More
Upgrade Ubuntu From Dapper(6.06) to Edgy(6.10)
A guide for upgrading Ubuntu from Dapper to Edgy Eft using the built-in update methods.Ubuntu Edgy Eft is a more experimental build of Ubuntu. If you are looking for the most stable release, you would want to use Ubuntu Dapper, which has long term support from Ubuntu.
Edgy includes the latest version of Firefox, as well as a lot of graphical enhancements. If you aren't scared yet, let's get to installing.
1) Open a terminal window and type in the following command:
gksu update-manager -c -d
2) You will be prompted to enter your password, at which point you will see a screen saying "New distribution release '6.10' is available". Click the Upgrade button to continue.
3) Click "Upgrade" again at the release notes screen
4) Click "Start Upgrade" when you see the screen asking if you want to start the upgrade.
5) Reboot the computer, and enjoy Firefox 2.0
Note: If you have a highly customized installation of Ubuntu Dapper, you probably won't want to do an upgrade, but rather a full install.... Read More
How to upgrade Firefox in Linux
This is for linux users only. When it comes to upgrade the firefox from lower version to upper version I could not find the standard way to do it. This is what I did.This is for linux users only.
Go to firefox site to see the latest updates. e.g.
http://www.mozilla.com/en-US/firefox/all.html
download firefox.xx.tar.gz
untar and unzip the file:
tar xvfz firefox.xx.tar.gz
You will see a firefox directory in it.
On your terminal type:
whereis firefox
it will give - /usr/bin/firefox and /usr/lib/firefox
Go to /usr/lib (cd /usr/lib)
You will see the firefox directory there. Replace this firefox directory with what you have got from download.
Restart firefox.
Latest version is installed. Enjoy.... Read More