sulekha
this is what i have read about negative caching in the book , "practical guide to Ubuntu Linux by mark sobell"
Storing the knowledge that something does not exist. A cache normally stores information about something that exists. A negative cache stores the information that something, such as a record, does not exist.
can any one give an example(s) / practical situation(s) where and why this is used ?
iponeverything
Squid does negative caching, it saves a lot of time with not having to go out and look for something that you already know does not exist.
kenjackson
DNS requires that caching nameservers remember negative responses as well as positive ones. If an authoritative nameserver returns a negative response, indicating that a name does not exist, this is cached. The negative response may be perceived as a failure at the application level; however, to the nameserver caching it, it is not a failure.
Tuesday, December 30, 2008
Monday, December 29, 2008
Howto: Restart Ubuntu Linux safely when it is frozen or locked up!
If anyone faces a freeze with Ubuntu where you cannot do anything, then this will certainly be helpful if you want to reboot the OS as cleanly as possible without damaging their HDD's or losing their data.
In case of a freeze where you cannot do anything, simply press Alt+PrintScreen+R+E+I+S+U+B, keep in mind that the italicized keys must be kept pressed through the rest of the sequence AND that you will need to keep holding the sequence keys for a small period of time before going to the next one so that their actions can be carried out properly (For example, hold the R key for about 1-2 seconds before moving on to S). If the sequence does not work at first, then increase the time period between each sequence key press and try again.
It stands for Raw (take control of keyboard back from X), tErminate (send SIGTERM to all processes, allowing them to terminate gracefully), kIll (send SIGKILL to all processes, forcing them to terminate immediately), Sync (flush data to disk), Unmount (remount all filesystems read-only), reBoot. These keystrokes should be entered a few seconds apart. This should prevent a fsck being required on reboot; it also gives some programs a chance to save emergency backups of unsaved work.
Here is a breakdown of the other sysrq keys:
0 - 9 - sets the console log level, controlling which kernel messages will be printed to your console so that you don't get flooded.
B - restarts the system without making steps to ensure that the conditions are good for a safe reboot, using this key alone is like doing a cold reboot.
E - sends SIGTERM to all processes except init. This means that an attempt is done to end the current processes except init, safely, e.g. saving a document.
F - call oom_kill(Out Of Memory Killer), which will kill a process that is consuming all available memory.
H - displays help about the SysRq keys on a terminal though in actuality you can use any key except for the ones specified, to display help.
I - sends SIGKILL to all processes except init. This means that all the processes except for init are killed, any data in processes that are killed will be lost.
K - kills all processes on the current terminal. It is a bad idea to do this on a console where X is running as the GUI will stop and you can't see what you type, so you will need to switch to a tty after doing the magic SysRq.
L - sends SIGKILL to all processes, including init. This means that every process including init will be killed, using this key will render your system non-functional and no further magicSysRq keys can be used. So in this case you will have to cold reboot it.
M - dumps memory info to your console.
O - shuts down the system via ACPI or in older systems, APM. As in key "B", using this key alone is like a cold reboot(Or in this case, a cold shutdown).
P - dumps the current registers and flags to your console.
Q - dumps all timers info to your console.
R - takes keyboard and mouse control from the X server. This can be useful if the X-Server crashed, you can change to a console and kill the X-Server or check the error log.
S - writes all data from the disc cache to the hard-discs, it is a sync and is necessary to reduce the chances of data corruption.
T - dumps a list of current tasks and info to your console.
U - remounts all mounted filesystems read-only. After using this key, you can reboot the system with Alt+SysRq+B without harming the system.
W - dumps uninterruptable (blocked) state tasks.
For more information see:- http://en.wikipedia.org/wiki/Magic_SysRq_key
source:- http://www.ubuntu-unleashed.com/2008/05/howto-restart-ubuntu-safely-when-it-is.html
In case of a freeze where you cannot do anything, simply press Alt+PrintScreen+R+E+I+S+U+B, keep in mind that the italicized keys must be kept pressed through the rest of the sequence AND that you will need to keep holding the sequence keys for a small period of time before going to the next one so that their actions can be carried out properly (For example, hold the R key for about 1-2 seconds before moving on to S). If the sequence does not work at first, then increase the time period between each sequence key press and try again.
It stands for Raw (take control of keyboard back from X), tErminate (send SIGTERM to all processes, allowing them to terminate gracefully), kIll (send SIGKILL to all processes, forcing them to terminate immediately), Sync (flush data to disk), Unmount (remount all filesystems read-only), reBoot. These keystrokes should be entered a few seconds apart. This should prevent a fsck being required on reboot; it also gives some programs a chance to save emergency backups of unsaved work.
Here is a breakdown of the other sysrq keys:
0 - 9 - sets the console log level, controlling which kernel messages will be printed to your console so that you don't get flooded.
B - restarts the system without making steps to ensure that the conditions are good for a safe reboot, using this key alone is like doing a cold reboot.
E - sends SIGTERM to all processes except init. This means that an attempt is done to end the current processes except init, safely, e.g. saving a document.
F - call oom_kill(Out Of Memory Killer), which will kill a process that is consuming all available memory.
H - displays help about the SysRq keys on a terminal though in actuality you can use any key except for the ones specified, to display help.
I - sends SIGKILL to all processes except init. This means that all the processes except for init are killed, any data in processes that are killed will be lost.
K - kills all processes on the current terminal. It is a bad idea to do this on a console where X is running as the GUI will stop and you can't see what you type, so you will need to switch to a tty after doing the magic SysRq.
L - sends SIGKILL to all processes, including init. This means that every process including init will be killed, using this key will render your system non-functional and no further magicSysRq keys can be used. So in this case you will have to cold reboot it.
M - dumps memory info to your console.
O - shuts down the system via ACPI or in older systems, APM. As in key "B", using this key alone is like a cold reboot(Or in this case, a cold shutdown).
P - dumps the current registers and flags to your console.
Q - dumps all timers info to your console.
R - takes keyboard and mouse control from the X server. This can be useful if the X-Server crashed, you can change to a console and kill the X-Server or check the error log.
S - writes all data from the disc cache to the hard-discs, it is a sync and is necessary to reduce the chances of data corruption.
T - dumps a list of current tasks and info to your console.
U - remounts all mounted filesystems read-only. After using this key, you can reboot the system with Alt+SysRq+B without harming the system.
W - dumps uninterruptable (blocked) state tasks.
For more information see:- http://en.wikipedia.org/wiki/Magic_SysRq_key
source:- http://www.ubuntu-unleashed.com/2008/05/howto-restart-ubuntu-safely-when-it-is.html
Saturday, December 27, 2008
My Hard Drive Is Clicking Again So I’m Stopping It Cold When Ubuntu Boots
source: http://eric.biven.us/2008/10/09/my-hard-drive-is-clicking-again-so-im-stopping-it-cold-when-ubuntu-boots/
aarklon
Earlier I wrote an article discussing the hyperactive APM modes that some drive manufacturers use and how that leads to excessive head parking and severly reduced drive life. It seems newer versions of Ubuntu and Kubuntu are coming with APM on the drives completely disabled (a setting of 255 using the -B option of the hdparm command). This is all swell and good but disregards the fact that many of us have hardware that doesn't support the 255 option and rely on the slightly lower setting of 254, which doesn't completely disable APM on the drive but causes it to be very, very slow to park.
So let's set up the system for the rest of us. First we need to edit the /etc/hdparm.conf file and add this at the end. Please be aware that your hard drive may not be "/dev/sda" like mine, so make sure you get that part right for your system.
/dev/sda {
apm = 254
}
Finally, let's reboot and check our current APM settings on the drive to be sure our settings are being applied at startup. The command to check the drive's current state is:
sudo hdparm -I /dev/sda|grep "Advanced power management level:"
If that shows you a value of 254 then you're golden. Congratulations on extending the life of your hard drive. It looks like the folks at Ubuntu also got this sorted out for both ATA and SATA drives when resuming from sleep, but do yourself a favor and check that on your system as well.
As a side note, how can you tell how many times the heads have parked? First, install the smartmontools package, then check the number of load cycles that the drive has gone through:
sudo apt-get install smartmontools
sudo smartctl -A /dev/sda|grep "Load_Cycle_Count"
As a rule of thumb most consumer drives can load cycle at or just above 500,000 times. Be aware that this isn't a hard limit, it's just a guess. Your mileage will vary.
source: http://eric.biven.us/2008/10/09/my-hard-drive-is-clicking-again-so-im-stopping-it-cold-when-ubuntu-boots/
see: http://ubuntuforums.org/showthread.php?t=1021561&highlight=hard+drive+clicking
I tried what is said in this howto and found that my clicking sound
has
now reduced to a very small noise, now what i want is to eliminate
this sound completely, so how to do it ?
what is the method/means to know if hardware doesn't support 255
option ?
How to find out the optimal apm value for a particular hard disk ?
NB: I use ubuntu 8.04.1
propman
http://www.samsung.com/global/business/hdd/
Anton Ertl
Yes, the load cycles would also be my first guess, a start-stop cycle my second. You can check which one is the case with the method mentioned in the posting:
smartctl -a /dev/hda|grep Count
If the Start_Stop_Count goes up on clicking, it's a start-stop cycle (full spindown and spin-up); if only the Load_Cycle_Count goes up, then it's a load cycle (parking and unparking the head assembly in its rest position).
> I tried what is said in this howto and found that my clicking sound
>has
> now reduced to a very small noise, now what i want is to eliminate
>this sound completely, so how to do it ?
> what is the method/means to know if hardware doesn't support 255
>option ?
From what I read in the hdparm man page, trying 255 does not hurt. So you could try it, and if there's still clicking, settle for 254. For my purposes 254 is good enough, though.
What I find strange is that you write that the clicking is reduced to a very small noise; a load cycle should have the same volume when it happens, it should just happen much more rarely. Maybe the lower-volume stuff is ordinary head-moving noise. You may be able to reduce that noise with "hdparm -M 128 /dev/..." (sorry, I don't know the name of this setting in /etc/hdparm.conf).
The other thing I wonder about is: What do you mean when you write "whenever the computer stops"?
sheridan hutchinson
There are two types of clicking that occur. Either, I'm dying clicking from the drive itself, or the sound of the drive heads parking due to power management.
As you describe this happening when activity calms down I'm going to assume the latter.
If this a laptop? If this is a laptop this is desirable as it will decrease power usage.
In Debian or Ubuntu the laptop-mode-tools package manages this. You need to go through the configuration file with a fine tooth comb to get the settings how you want them. If you do use laptop-mode-tools you can be assured that there is a way of disabling this when on AC and or battery.
If you are using a desktop then this is and odd situation however I think you could use hdparm and configure that to disable the powermanagement completely.
annalissa
when i issue the command sudo telinit 0 or when i click system ->
Quit option
the following is the o/p of my smartctl command
zodiac@ubuntu:~$ sudo smartctl -a /dev/sdb
[sudo] password for zodiac:
smartctl version 5.37 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce
Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF INFORMATION SECTION ===
Device Model: SAMSUNG HD252HJ
Serial Number: S17HJ9DQ803060
Firmware Version: 1AC01113
User Capacity: 250,059,350,016 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 7
ATA Standard is: Not recognized. Minor revision code: 0x52
Local Time is: Sun Dec 28 11:38:48 2008 EST
==> WARNING: May need -F samsung or -F samsung2 enabled; see manual
for details.
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status: (0x00) Offline data collection
activity
was never started.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 0) The previous self-test routine
completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: (3751) seconds.
Offline data collection
capabilities: (0x7b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before
entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 63) minutes.
Conveyance self-test routine
recommended polling time: ( 8) minutes.
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE
UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000f 100 100 051 Pre-fail
Always - 0
3 Spin_Up_Time 0x0007 094 094 011 Pre-fail
Always - 2840
4 Start_Stop_Count 0x0032 100 100 000 Old_age
Always - 55
5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail
Always - 0
7 Seek_Error_Rate 0x000f 253 253 051 Pre-fail
Always - 0
8 Seek_Time_Performance 0x0025 100 100 015 Pre-fail
Offline - 0
9 Power_On_Hours 0x0032 100 100 000 Old_age
Always - 84
10 Spin_Retry_Count 0x0033 100 100 051 Pre-fail
Always - 0
11 Calibration_Retry_Count 0x0012 100 100 000 Old_age
Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age
Always - 55
13 Read_Soft_Error_Rate 0x000e 100 100 000 Old_age
Always - 0
183 Unknown_Attribute 0x0032 100 100 000 Old_age
Always - 0
184 Unknown_Attribute 0x0033 100 100 099 Pre-fail
Always - 0
187 Unknown_Attribute 0x0032 100 100 000 Old_age
Always - 0
188 Unknown_Attribute 0x0032 100 100 000 Old_age
Always - 0
190 Temperature_Celsius 0x0022 076 066 000 Old_age
Always - 403963928
194 Temperature_Celsius 0x0022 071 065 000 Old_age
Always - 29 (Lifetime Min/Max 0/7444)
195 Hardware_ECC_Recovered 0x001a 100 100 000 Old_age
Always - 10
196 Reallocated_Event_Count 0x0032 100 100 000 Old_age
Always - 0
197 Current_Pending_Sector 0x0012 100 100 000 Old_age
Always - 0
198 Offline_Uncorrectable 0x0030 100 100 000 Old_age
Offline - 0
199 UDMA_CRC_Error_Count 0x003e 100 100 000 Old_age
Always - 0
200 Multi_Zone_Error_Rate 0x000a 100 100 000 Old_age
Always - 0
201 Soft_Read_Error_Rate 0x000a 253 253 000 Old_age
Always - 0
SMART Error Log Version: 1
No Errors Logged
SMART Self-test log structure revision number 0
Warning: ATA Specification requires self-test log structure revision
number = 1
No self-tests have been logged. [To run self-tests, use: smartctl -t]
SMART Selective Self-Test Log Data Structure Revision Number (0)
should be 1
SMART Selective self-test log data structure revision number 0
Warning: ATA Specification requires selective self-test log data
structure revision number = 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute
delay.
Anton Ertl
Ok, so you halt the system. Parking the head is fine under these circumstances, and clicking is normal; now that I think of it, my system also produces a very audible click when I shut it down, and that may well come from the Samsung drive I have (HD753LJ). And the hdparm apm (-B) setting won't affect this; the -M setting might make it quieter, but I doubt it.
Is there any particular reason why you want to make that click
quieter?
>zodiac@ubuntu:~$ sudo smartctl -a /dev/sdb
Hmm, no Load_Cycle_Count (neither for my Samsung disk), but since this is a desktop disk, it probably won't park the head unless it is spinning down (i.e., load-cycle count = start-stop count).
anton ertl
Sheridan Hutchinson writes:
[heads parking]
>If this a laptop? If this is a laptop this is desirable as it will
>decrease power usage.
AFAIK parking does not decrease power usage. Laptop drives do it as a safety precaution: if the user drops the laptop, the chances of the drive surviving are much better if the heads are parked than if they are not.
Spinning down does decrease power usage (but spinning up again takes a few seconds, so drives are much more reluctant to do it).
However, the OP uses a 3.5" desktop drive.
Back to laptops and heads parking:
However, in Linux normally the system writes the atime of various files every few seconds, so it unparks the heads very shortly after they are parked, leading to very high load-cycle counts for some drives unless you tell the drive to be less aggressive with their head parking (my latest laptop drive reached 300000 load cycles before I noticed that); you can then reach the life expectancy of the drive (a SMART VALUE entry of 0) wrt load cycles in less than a year on some
drives. So you should either tell the drive to be less aggressive with parking, or tell the OS to write less (e.g., by mounting the file systems with the noatime option, and/or by using laptop mode). On my laptop I took the first approach.
aarklon
BTW how could you figure out from the o/p of sudo smartctl -a /dev/sdb ,that i am using desktop hard disk ?
pascal hambourg
Probably from the device model "SAMSUNG HD252HJ". BTW, my Hitachi hard disk drive also makes a clicking sound when parking the heads at shutdown. I believe this is perfectly normal.
Aragorn
It is. Most hard disk models park the heads on the inner cylinder, but Hitachi disks park their heads on a ramp outside of the platter circumference. Yet, all modern hard disks not only park their heads in the sense of "moving them away from the readable/writable surface of the
platters" but they will also lock the heads in their parked position. As such, you would hear two sounds: one from the heads moving to their respective landing zone, and one from the heads being locked in place there.
Anton ertl
AFAIK that's no longer true. They used to do that several years ago, but nowadays the surfaces and the heads are so smooth that they would stick together if the heads landed on the surface, so now they are all doing this:
aarklon
Earlier I wrote an article discussing the hyperactive APM modes that some drive manufacturers use and how that leads to excessive head parking and severly reduced drive life. It seems newer versions of Ubuntu and Kubuntu are coming with APM on the drives completely disabled (a setting of 255 using the -B option of the hdparm command). This is all swell and good but disregards the fact that many of us have hardware that doesn't support the 255 option and rely on the slightly lower setting of 254, which doesn't completely disable APM on the drive but causes it to be very, very slow to park.
So let's set up the system for the rest of us. First we need to edit the /etc/hdparm.conf file and add this at the end. Please be aware that your hard drive may not be "/dev/sda" like mine, so make sure you get that part right for your system.
/dev/sda {
apm = 254
}
Finally, let's reboot and check our current APM settings on the drive to be sure our settings are being applied at startup. The command to check the drive's current state is:
sudo hdparm -I /dev/sda|grep "Advanced power management level:"
If that shows you a value of 254 then you're golden. Congratulations on extending the life of your hard drive. It looks like the folks at Ubuntu also got this sorted out for both ATA and SATA drives when resuming from sleep, but do yourself a favor and check that on your system as well.
As a side note, how can you tell how many times the heads have parked? First, install the smartmontools package, then check the number of load cycles that the drive has gone through:
sudo apt-get install smartmontools
sudo smartctl -A /dev/sda|grep "Load_Cycle_Count"
As a rule of thumb most consumer drives can load cycle at or just above 500,000 times. Be aware that this isn't a hard limit, it's just a guess. Your mileage will vary.
source: http://eric.biven.us/2008/10/09/my-hard-drive-is-clicking-again-so-im-stopping-it-cold-when-ubuntu-boots/
see: http://ubuntuforums.org/showthread.php?t=1021561&highlight=hard+drive+clicking
I tried what is said in this howto and found that my clicking sound
has
now reduced to a very small noise, now what i want is to eliminate
this sound completely, so how to do it ?
what is the method/means to know if hardware doesn't support 255
option ?
How to find out the optimal apm value for a particular hard disk ?
NB: I use ubuntu 8.04.1
propman
http://www.samsung.com/global/business/hdd/
Anton Ertl
Yes, the load cycles would also be my first guess, a start-stop cycle my second. You can check which one is the case with the method mentioned in the posting:
smartctl -a /dev/hda|grep Count
If the Start_Stop_Count goes up on clicking, it's a start-stop cycle (full spindown and spin-up); if only the Load_Cycle_Count goes up, then it's a load cycle (parking and unparking the head assembly in its rest position).
> I tried what is said in this howto and found that my clicking sound
>has
> now reduced to a very small noise, now what i want is to eliminate
>this sound completely, so how to do it ?
> what is the method/means to know if hardware doesn't support 255
>option ?
From what I read in the hdparm man page, trying 255 does not hurt. So you could try it, and if there's still clicking, settle for 254. For my purposes 254 is good enough, though.
What I find strange is that you write that the clicking is reduced to a very small noise; a load cycle should have the same volume when it happens, it should just happen much more rarely. Maybe the lower-volume stuff is ordinary head-moving noise. You may be able to reduce that noise with "hdparm -M 128 /dev/..." (sorry, I don't know the name of this setting in /etc/hdparm.conf).
The other thing I wonder about is: What do you mean when you write "whenever the computer stops"?
sheridan hutchinson
There are two types of clicking that occur. Either, I'm dying clicking from the drive itself, or the sound of the drive heads parking due to power management.
As you describe this happening when activity calms down I'm going to assume the latter.
If this a laptop? If this is a laptop this is desirable as it will decrease power usage.
In Debian or Ubuntu the laptop-mode-tools package manages this. You need to go through the configuration file with a fine tooth comb to get the settings how you want them. If you do use laptop-mode-tools you can be assured that there is a way of disabling this when on AC and or battery.
If you are using a desktop then this is and odd situation however I think you could use hdparm and configure that to disable the powermanagement completely.
annalissa
when i issue the command sudo telinit 0 or when i click system ->
Quit option
the following is the o/p of my smartctl command
zodiac@ubuntu:~$ sudo smartctl -a /dev/sdb
[sudo] password for zodiac:
smartctl version 5.37 [i686-pc-linux-gnu] Copyright (C) 2002-6 Bruce
Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF INFORMATION SECTION ===
Device Model: SAMSUNG HD252HJ
Serial Number: S17HJ9DQ803060
Firmware Version: 1AC01113
User Capacity: 250,059,350,016 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 7
ATA Standard is: Not recognized. Minor revision code: 0x52
Local Time is: Sun Dec 28 11:38:48 2008 EST
==> WARNING: May need -F samsung or -F samsung2 enabled; see manual
for details.
SMART support is: Available - device has SMART capability.
SMART support is: Enabled
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED
General SMART Values:
Offline data collection status: (0x00) Offline data collection
activity
was never started.
Auto Offline Data Collection: Disabled.
Self-test execution status: ( 0) The previous self-test routine
completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: (3751) seconds.
Offline data collection
capabilities: (0x7b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities: (0x0003) Saves SMART data before
entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability: (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 63) minutes.
Conveyance self-test routine
recommended polling time: ( 8) minutes.
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE
UPDATED WHEN_FAILED RAW_VALUE
1 Raw_Read_Error_Rate 0x000f 100 100 051 Pre-fail
Always - 0
3 Spin_Up_Time 0x0007 094 094 011 Pre-fail
Always - 2840
4 Start_Stop_Count 0x0032 100 100 000 Old_age
Always - 55
5 Reallocated_Sector_Ct 0x0033 100 100 010 Pre-fail
Always - 0
7 Seek_Error_Rate 0x000f 253 253 051 Pre-fail
Always - 0
8 Seek_Time_Performance 0x0025 100 100 015 Pre-fail
Offline - 0
9 Power_On_Hours 0x0032 100 100 000 Old_age
Always - 84
10 Spin_Retry_Count 0x0033 100 100 051 Pre-fail
Always - 0
11 Calibration_Retry_Count 0x0012 100 100 000 Old_age
Always - 0
12 Power_Cycle_Count 0x0032 100 100 000 Old_age
Always - 55
13 Read_Soft_Error_Rate 0x000e 100 100 000 Old_age
Always - 0
183 Unknown_Attribute 0x0032 100 100 000 Old_age
Always - 0
184 Unknown_Attribute 0x0033 100 100 099 Pre-fail
Always - 0
187 Unknown_Attribute 0x0032 100 100 000 Old_age
Always - 0
188 Unknown_Attribute 0x0032 100 100 000 Old_age
Always - 0
190 Temperature_Celsius 0x0022 076 066 000 Old_age
Always - 403963928
194 Temperature_Celsius 0x0022 071 065 000 Old_age
Always - 29 (Lifetime Min/Max 0/7444)
195 Hardware_ECC_Recovered 0x001a 100 100 000 Old_age
Always - 10
196 Reallocated_Event_Count 0x0032 100 100 000 Old_age
Always - 0
197 Current_Pending_Sector 0x0012 100 100 000 Old_age
Always - 0
198 Offline_Uncorrectable 0x0030 100 100 000 Old_age
Offline - 0
199 UDMA_CRC_Error_Count 0x003e 100 100 000 Old_age
Always - 0
200 Multi_Zone_Error_Rate 0x000a 100 100 000 Old_age
Always - 0
201 Soft_Read_Error_Rate 0x000a 253 253 000 Old_age
Always - 0
SMART Error Log Version: 1
No Errors Logged
SMART Self-test log structure revision number 0
Warning: ATA Specification requires self-test log structure revision
number = 1
No self-tests have been logged. [To run self-tests, use: smartctl -t]
SMART Selective Self-Test Log Data Structure Revision Number (0)
should be 1
SMART Selective self-test log data structure revision number 0
Warning: ATA Specification requires selective self-test log data
structure revision number = 1
SPAN MIN_LBA MAX_LBA CURRENT_TEST_STATUS
1 0 0 Not_testing
2 0 0 Not_testing
3 0 0 Not_testing
4 0 0 Not_testing
5 0 0 Not_testing
Selective self-test flags (0x0):
After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute
delay.
Anton Ertl
Ok, so you halt the system. Parking the head is fine under these circumstances, and clicking is normal; now that I think of it, my system also produces a very audible click when I shut it down, and that may well come from the Samsung drive I have (HD753LJ). And the hdparm apm (-B) setting won't affect this; the -M setting might make it quieter, but I doubt it.
Is there any particular reason why you want to make that click
quieter?
>zodiac@ubuntu:~$ sudo smartctl -a /dev/sdb
Hmm, no Load_Cycle_Count (neither for my Samsung disk), but since this is a desktop disk, it probably won't park the head unless it is spinning down (i.e., load-cycle count = start-stop count).
anton ertl
Sheridan Hutchinson
[heads parking]
>If this a laptop? If this is a laptop this is desirable as it will
>decrease power usage.
AFAIK parking does not decrease power usage. Laptop drives do it as a safety precaution: if the user drops the laptop, the chances of the drive surviving are much better if the heads are parked than if they are not.
Spinning down does decrease power usage (but spinning up again takes a few seconds, so drives are much more reluctant to do it).
However, the OP uses a 3.5" desktop drive.
Back to laptops and heads parking:
However, in Linux normally the system writes the atime of various files every few seconds, so it unparks the heads very shortly after they are parked, leading to very high load-cycle counts for some drives unless you tell the drive to be less aggressive with their head parking (my latest laptop drive reached 300000 load cycles before I noticed that); you can then reach the life expectancy of the drive (a SMART VALUE entry of 0) wrt load cycles in less than a year on some
drives. So you should either tell the drive to be less aggressive with parking, or tell the OS to write less (e.g., by mounting the file systems with the noatime option, and/or by using laptop mode). On my laptop I took the first approach.
aarklon
BTW how could you figure out from the o/p of sudo smartctl -a /dev/sdb ,that i am using desktop hard disk ?
pascal hambourg
Probably from the device model "SAMSUNG HD252HJ". BTW, my Hitachi hard disk drive also makes a clicking sound when parking the heads at shutdown. I believe this is perfectly normal.
Aragorn
It is. Most hard disk models park the heads on the inner cylinder, but Hitachi disks park their heads on a ramp outside of the platter circumference. Yet, all modern hard disks not only park their heads in the sense of "moving them away from the readable/writable surface of the
platters" but they will also lock the heads in their parked position. As such, you would hear two sounds: one from the heads moving to their respective landing zone, and one from the heads being locked in place there.
Anton ertl
AFAIK that's no longer true. They used to do that several years ago, but nowadays the surfaces and the heads are so smooth that they would stick together if the heads landed on the surface, so now they are all doing this:
Wednesday, December 24, 2008
Use the Contents of the /proc Directory to Interact with the Kernel
/proc/asound/version find alsa version
/proc/cpuinfo. Getting CPU information, such as the family, type, and speed
/proc/net Viewing important networking information under
/proc/net/dev, such as active interfaces information
/proc/net/route routing information
/proc/net/netstat network statistics.
/proc/kmsg Contains messages generated by the kernel
/proc/loadavg Lists the system load average
/proc/meminfo Displays memory usage
/proc/modules Lists the kernel modules currently loaded
/proc/mounts Shows all mounted file systems in Linux
/proc/net Lists status information about network protocols
/proc/stat
Contains system operating statistics, such as page fault occurrences,other statistics such as CPU load, swap file usage
/proc/uptime Displays the time the system has been up
/proc/version Displays the kernel version
Retrieving file system information.
/proc/interrupts Displays the interrupts in use
/proc/ioports Shows the I/O ports in use
/proc/num
Each process is held in a directory that’s labeled by its number: /proc/1 is the directory for process 1, for example
/proc/devices
Lists the device drivers configured for the currently running kernel
/proc/dma
Displays the Direct Memory Access (DMA) channels currently used
/proc/filesystems
Lists file systems configured into the kernel
proc/kcore
Holds an image of the physical memory of the system
/proc/net/arp
when a linux system (or any device with ethernet) wishes to address an IP address, the ARP request message "who is X.X.X.X tell Y.Y.Y.Y" is sent using the ethernet broadcast address. the target system forms an arp response "X.X.X.X" is hh:hh:hh:hh:hh:hh and sends it to the requesting host.An arp response is cached for a short time in /proc/net/arp to avoid the need to continually reestablish the mapping between hardware ethernet addresses and IP addresses.
/proc/sys/net/core/netdev_max_backlog
When the kernel receives packets from the places them on a special queue.By default, a maximum of 300 packets is allowed on the queue. Under extraordinary circumstances,you may need to edit this file and change the value for the allowed maximum.
/proc/sys/net/ipv4/icmp_echo_ignore_all
Default = 0, meaning that the kernel will respond to Internet Control Message Protocol ICMP) echo-reply messages. Set this to 1 to tell the kernel to stop replying to those messages.
/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
Default = 0, meaning that the kernel will allow ICMP responses to be sent to broadcast or multicast addresses.
/proc/sys/net/ipv4/ip_forward
Default = 0, meaning the kernel will not forward packets between network interfaces.To allow forwarding (e.g., for routing), change this to 1.
/proc/sys/net/ipv4/ip_local_port_range
Range of ports Linux will use when originating a connection. Default = 32768–61000.
/proc/sys/net/ipv4/tcp_syn_cookies
Default = 0 (Off). Change to 1 (On) to enable protection for the system against SYN flood attacks.
Reporting media mount point information via USB; for example, the Linux kernel reports what device to use to access files (such as /dev/sda) if a USB camera or hard drive is detected on the system. You can use the dmesg command to see this information.
See http://procps.sourceforge.net/faq.html
/proc/cpuinfo. Getting CPU information, such as the family, type, and speed
/proc/net Viewing important networking information under
/proc/net/dev, such as active interfaces information
/proc/net/route routing information
/proc/net/netstat network statistics.
/proc/kmsg Contains messages generated by the kernel
/proc/loadavg Lists the system load average
/proc/meminfo Displays memory usage
/proc/modules Lists the kernel modules currently loaded
/proc/mounts Shows all mounted file systems in Linux
/proc/net Lists status information about network protocols
/proc/stat
Contains system operating statistics, such as page fault occurrences,other statistics such as CPU load, swap file usage
/proc/uptime Displays the time the system has been up
/proc/version Displays the kernel version
Retrieving file system information.
/proc/interrupts Displays the interrupts in use
/proc/ioports Shows the I/O ports in use
/proc/num
Each process is held in a directory that’s labeled by its number: /proc/1 is the directory for process 1, for example
/proc/devices
Lists the device drivers configured for the currently running kernel
/proc/dma
Displays the Direct Memory Access (DMA) channels currently used
/proc/filesystems
Lists file systems configured into the kernel
proc/kcore
Holds an image of the physical memory of the system
/proc/net/arp
when a linux system (or any device with ethernet) wishes to address an IP address, the ARP request message "who is X.X.X.X tell Y.Y.Y.Y" is sent using the ethernet broadcast address. the target system forms an arp response "X.X.X.X" is hh:hh:hh:hh:hh:hh and sends it to the requesting host.An arp response is cached for a short time in /proc/net/arp to avoid the need to continually reestablish the mapping between hardware ethernet addresses and IP addresses.
/proc/sys/net/core/netdev_max_backlog
When the kernel receives packets from the places them on a special queue.By default, a maximum of 300 packets is allowed on the queue. Under extraordinary circumstances,you may need to edit this file and change the value for the allowed maximum.
/proc/sys/net/ipv4/icmp_echo_ignore_all
Default = 0, meaning that the kernel will respond to Internet Control Message Protocol ICMP) echo-reply messages. Set this to 1 to tell the kernel to stop replying to those messages.
/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
Default = 0, meaning that the kernel will allow ICMP responses to be sent to broadcast or multicast addresses.
/proc/sys/net/ipv4/ip_forward
Default = 0, meaning the kernel will not forward packets between network interfaces.To allow forwarding (e.g., for routing), change this to 1.
/proc/sys/net/ipv4/ip_local_port_range
Range of ports Linux will use when originating a connection. Default = 32768–61000.
/proc/sys/net/ipv4/tcp_syn_cookies
Default = 0 (Off). Change to 1 (On) to enable protection for the system against SYN flood attacks.
Reporting media mount point information via USB; for example, the Linux kernel reports what device to use to access files (such as /dev/sda) if a USB camera or hard drive is detected on the system. You can use the dmesg command to see this information.
See http://procps.sourceforge.net/faq.html
Tuesday, December 23, 2008
installing vista fonts in ubuntu
see:- http://ubuntu.wordpress.com/2007/09/16/installing-vista-fonts-in-ubuntu/
preload
Preload is a little application that monitors files of frequently used applications and and loads them in to the memory when system is idle. This usually results in lesser startup times for those applications. Install preload by executing following command.
sudo apt-get -y install preload
sudo apt-get -y install preload
digital camera support in Linux
Linux supports over 800 cameras through the gPhoto2 digital camera software package, which comes bundled with your system. What gPhoto2 essentially consists of is a collection of drivers that
works in the background to tell your computer how to communicate with your camera. To see if your camera is supported, go to the gPhoto2 website (www.gphoto.org), scroll down, and click 800 cameras (the number may actually be higher when you check). On that page you will find a complete
list of all the cameras supported by gPhoto2. If your camera isn’t on the list, it most likely means (as the page points out) that your camera is so old that there is little demand for support for it or that it is so new that there hasn’t been enough time to develop support for it. Of course, gPhoto2 is constantly being updated, so if your camera isn’t on the list now, it could be in the near future. Updating gPhoto2 with Synaptic now and again should keep you as up to date as possible.
works in the background to tell your computer how to communicate with your camera. To see if your camera is supported, go to the gPhoto2 website (www.gphoto.org), scroll down, and click 800 cameras (the number may actually be higher when you check). On that page you will find a complete
list of all the cameras supported by gPhoto2. If your camera isn’t on the list, it most likely means (as the page points out) that your camera is so old that there is little demand for support for it or that it is so new that there hasn’t been enough time to develop support for it. Of course, gPhoto2 is constantly being updated, so if your camera isn’t on the list now, it could be in the near future. Updating gPhoto2 with Synaptic now and again should keep you as up to date as possible.
Monday, December 22, 2008
linux/ubuntu forums
http://www.ubuntuforums.org
The official Ubuntu community forum.Always a good place to start when you’re in a fix, have a question, or justwant to find out what’s going on.
http://www.ubuntux.org/forum
Another slightly smaller Ubuntu specific forum. A good place to turn if you find UbuntuForums.org a bit too much to wade through.
http://www.kubuntuforums.net
A forum dedicated to Kubuntu, an official Ubuntu edition based on the KDE desktop environment.
http://www.justlinux.com
If you can’t find what you want in the previously mentioned forums, you can try this or the following two forums dealing with general Linux issues. You are sure to find many Ubuntu users on any of them.
http://www.linuxforum.com
http://www.linuxquestions.org
The official Ubuntu community forum.Always a good place to start when you’re in a fix, have a question, or justwant to find out what’s going on.
http://www.ubuntux.org/forum
Another slightly smaller Ubuntu specific forum. A good place to turn if you find UbuntuForums.org a bit too much to wade through.
http://www.kubuntuforums.net
A forum dedicated to Kubuntu, an official Ubuntu edition based on the KDE desktop environment.
http://www.justlinux.com
If you can’t find what you want in the previously mentioned forums, you can try this or the following two forums dealing with general Linux issues. You are sure to find many Ubuntu users on any of them.
http://www.linuxforum.com
http://www.linuxquestions.org
Using Nautilus as an FTP Client
Nautilus not only allows you to browse and mount shares on local networks, but it can also act as an FTP client, say for instance when you want to change the files for your website on a remote server. To do this, go to the Connect to Server window (File Connect to Server), and then select FTP (with login) for Service Type. Then type the information provided by your website host,and click the Connect button. An FTP Network Share icon will then appear on the desktop and in the side pane. Double-click that icon, type your password (for that account—not the one for your Ubuntu system, unless it happens to be the same) when prompted to do so, and then you will be able to view and add to the files you have there.
source:- Rickford Grant
verified on ubuntu 8.04
source:- Rickford Grant
verified on ubuntu 8.04
Saturday, December 20, 2008
sort command
sulekha
what is the algorithm used in the sort command ,for 2.6.24-21-generic linux kernels ?
gnashley
What sort command in the kernel? sort is a separate program, which uses glibc. It's part of the coreutils package, so you can get the sources and read for yourself.
Billymayday
/* Sort the array LINES with NLINES members, using TEMP for temporary space.
NLINES must be at least 2.
The input and output arrays are in reverse order, and LINES and
TEMP point just past the end of their respective arrays.
Use a recursive divide-and-conquer algorithm, in the style
suggested by Knuth volume 3 (2nd edition), exercise 5.2.4-23. Use
the optimization suggested by exercise 5.2.4-10; this requires room
for only 1.5*N lines, rather than the usual 2*N lines. Knuth
writes that this memory optimization was originally published by
D. A. Bell, Comp J. 1 (1958), 75. */
From coreutils 6.9
what is the algorithm used in the sort command ,for 2.6.24-21-generic linux kernels ?
gnashley
What sort command in the kernel? sort is a separate program, which uses glibc. It's part of the coreutils package, so you can get the sources and read for yourself.
Billymayday
/* Sort the array LINES with NLINES members, using TEMP for temporary space.
NLINES must be at least 2.
The input and output arrays are in reverse order, and LINES and
TEMP point just past the end of their respective arrays.
Use a recursive divide-and-conquer algorithm, in the style
suggested by Knuth volume 3 (2nd edition), exercise 5.2.4-23. Use
the optimization suggested by exercise 5.2.4-10; this requires room
for only 1.5*N lines, rather than the usual 2*N lines. Knuth
writes that this memory optimization was originally published by
D. A. Bell, Comp J. 1 (1958), 75. */
From coreutils 6.9
Get last accessed File time in Ubuntu Linux
Ubuntu Linux has a rich set of commands for manipulating and accessing files. The stat utility gives detailed access to file information, including last accessed and last modified file time.
From the terminal window, run the command with this syntax:
stat filename
ex:-
stat /usr/bin/k3b
File: `/usr/bin/k3b'
Size: 1996852 Blocks: 3912 IO Block: 4096 regular file
Device: 801h/2049d Inode: 5661472 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-09-30 18:59:08.000000000 +0530
Modify: 2008-01-30 17:31:38.000000000 +0530
Change: 2008-09-25 18:22:55.000000000 +0530
source :- how to geek
NB:- Tested on ubuntu 8.04.1
From the terminal window, run the command with this syntax:
stat filename
ex:-
stat /usr/bin/k3b
File: `/usr/bin/k3b'
Size: 1996852 Blocks: 3912 IO Block: 4096 regular file
Device: 801h/2049d Inode: 5661472 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2008-09-30 18:59:08.000000000 +0530
Modify: 2008-01-30 17:31:38.000000000 +0530
Change: 2008-09-25 18:22:55.000000000 +0530
source :- how to geek
NB:- Tested on ubuntu 8.04.1
pkill
Kill Linux Processes Easier with pkill
One of the best features in Linux is the way you can control processes from the command line, so if you have an application that locks up your GUI, you can always SSH over from another machine and just kill the offending process.
The problem is that if you are killing the same process repeatedly, it's very tedious to have to figure out the process ID every single time so that you can kill it… so here's the easier way to do it.
The Old Way
The classic way of killing processes meant you'd first need to use the ps command piped through grep to find the process you are trying to kill:
$ ps -ef | grep swiftfox
geek 7206 22694 0 Dec04 ? 00:00:00 /bin/sh /opt/swiftfox/swiftfox
geek 7209 7206 0 Dec04 ? 00:00:00 /bin/sh /opt/swiftfox/run-mozilla.sh /opt/swiftfox/swiftfox-bin
geek 7213 7209 0 Dec04 ? 00:04:29 /opt/swiftfox/swiftfox-bin
geek 14863 14224 0 18:19 pts/4 00:00:00 grep swiftfox
Then to kill the process, you'd have to use the kill command:
$ kill 7206
The New Way
Instead of going through all of that, you can simply use the pkill command if you already know the process name or part of it.
$ pkill swiftfox
It's as simple as that. You should note that pkill will kill all processes matching the search text, in this case swiftfox
If you want to see what process names are matched before using the pkill command, you can use the pgrep command. Passing the -l switch tells pgrep to show the process name as well.
$ pgrep -l swiftfox
7206 swiftfox
7213 swiftfox-bin
Swiftfox seems to crash on me a lot, so I've unfortunately had to use this command a lot lately.
source howtogeek
One of the best features in Linux is the way you can control processes from the command line, so if you have an application that locks up your GUI, you can always SSH over from another machine and just kill the offending process.
The problem is that if you are killing the same process repeatedly, it's very tedious to have to figure out the process ID every single time so that you can kill it… so here's the easier way to do it.
The Old Way
The classic way of killing processes meant you'd first need to use the ps command piped through grep to find the process you are trying to kill:
$ ps -ef | grep swiftfox
geek 7206 22694 0 Dec04 ? 00:00:00 /bin/sh /opt/swiftfox/swiftfox
geek 7209 7206 0 Dec04 ? 00:00:00 /bin/sh /opt/swiftfox/run-mozilla.sh /opt/swiftfox/swiftfox-bin
geek 7213 7209 0 Dec04 ? 00:04:29 /opt/swiftfox/swiftfox-bin
geek 14863 14224 0 18:19 pts/4 00:00:00 grep swiftfox
Then to kill the process, you'd have to use the kill command:
$ kill 7206
The New Way
Instead of going through all of that, you can simply use the pkill command if you already know the process name or part of it.
$ pkill swiftfox
It's as simple as that. You should note that pkill will kill all processes matching the search text, in this case swiftfox
If you want to see what process names are matched before using the pkill command, you can use the pgrep command. Passing the -l switch tells pgrep to show the process name as well.
$ pgrep -l swiftfox
7206 swiftfox
7213 swiftfox-bin
Swiftfox seems to crash on me a lot, so I've unfortunately had to use this command a lot lately.
source howtogeek
Show the List of Installed Packages on Ubuntu or Debian
While working on the instructions for compiling MonoDevelop from source, I relied heavily on the dpkg and apt-cache commands to tell me what was already installed vs what packages were available in the repository. After completing that article it occurred to me that I should explain how to show what packages are currently installed… so here we are.
The command we need to use is dpkg –get-selections, which will give us a list of all the currently installed packages.
$ dpkg --get-selections
adduser install
alsa-base install
alsa-utils install
apache2 install
apache2-mpm-prefork install
apache2-utils install
apache2.2-common install
apt install
apt-utils install
The full list can be long and unwieldy, so it's much easier to filter through grep to get results for the exact package you need. For instance, I wanted to see which php packages I had already installed through apt-get:
dpkg --get-selections | grep php
libapache2-mod-php5 install
php-db install
php-pear install
php-sqlite3 install
php5 install
php5-cli install
php5-common install
php5-gd install
php5-memcache install
php5-mysql install
php5-sqlite install
php5-sqlite3 install
php5-xsl install
For extra credit, you can find the locations of the files within a package from the list by using the dpkg -L command, such as:
dpkg -L php5-gd
/.
/usr
/usr/lib
/usr/lib/php5
/usr/lib/php5/20060613
/usr/lib/php5/20060613/gd.so
/usr/share
/usr/share/doc
/etc
/etc/php5
/etc/php5/conf.d
/etc/php5/conf.d/gd.ini
/usr/share/doc/php5-gd
Now I can take a look at the gd.ini file and change some settings around…
source:- how to geek
The command we need to use is dpkg –get-selections, which will give us a list of all the currently installed packages.
$ dpkg --get-selections
adduser install
alsa-base install
alsa-utils install
apache2 install
apache2-mpm-prefork install
apache2-utils install
apache2.2-common install
apt install
apt-utils install
The full list can be long and unwieldy, so it's much easier to filter through grep to get results for the exact package you need. For instance, I wanted to see which php packages I had already installed through apt-get:
dpkg --get-selections | grep php
libapache2-mod-php5 install
php-db install
php-pear install
php-sqlite3 install
php5 install
php5-cli install
php5-common install
php5-gd install
php5-memcache install
php5-mysql install
php5-sqlite install
php5-sqlite3 install
php5-xsl install
For extra credit, you can find the locations of the files within a package from the list by using the dpkg -L command, such as:
dpkg -L php5-gd
/.
/usr
/usr/lib
/usr/lib/php5
/usr/lib/php5/20060613
/usr/lib/php5/20060613/gd.so
/usr/share
/usr/share/doc
/etc
/etc/php5
/etc/php5/conf.d
/etc/php5/conf.d/gd.ini
/usr/share/doc/php5-gd
Now I can take a look at the gd.ini file and change some settings around…
source:- how to geek
See What Version of a Package Is Installed on Ubuntu
The package management system on Ubuntu makes it extremely simple to install and remove packages, but sometimes it's important to figure out what version of a particular package that you actually have installed.
The apt-get utilities are simply a front-end to the debian dpkg utility, which actually does the real work. You can use this utility to figure out what version is installed.
dpkg -s
ex:- dpkg -s k3b
The apt-get utilities are simply a front-end to the debian dpkg utility, which actually does the real work. You can use this utility to figure out what version is installed.
dpkg -s
ex:- dpkg -s k3b
apt-cache
When you are trying to install software on Ubuntu or Debian linux using the apt-get package system, quite often you'll forget the exact name of the package you are trying to install. Here's how you can get a little help figuring out what the name is.
Syntax:
apt-cache search SearchTerm
Ex:- apt-cache search monodevelop
Ex:- apt-cache search firefox | grep plugin
source how to geek
Syntax:
apt-cache search SearchTerm
Ex:- apt-cache search monodevelop
Ex:- apt-cache search firefox | grep plugin
source how to geek
How to Tell What Version of Ubuntu You Are Running
Telling what version of Ubuntu you are running is extremely easy. You would commonly use this command to figure out if you are running Edgy after you upgraded from Dapper.
cat /etc/issue.net
cat /etc/issue.net
Use the Windows Key for the "Start" Menu in Ubuntu Linux
Use the Windows Key for the "Start" Menu in Ubuntu Linux
Ubuntu has a dropdown menu at the top of the screen to launch applications, which is very similar to the way Windows has the start menu at the bottom of the screen. If you are a windows user new to Ubuntu, you may prefer to have the windows key launch the applications menu. Thankfully this is an easy thing to do in Ubuntu.
Go to the System \ Preferences \ Keyboard Shortcuts menu item:
Scroll down till you see the "Show the panel menu" item. Click in the Shortcut column, and when it changes to "New accelerator…", hit the Windows Key. Click the close button. You're done!
Now when you hit the windows key, the application menu will pop up. If you hit the right arrow key, you can go to the Places or System menu as well.
source: how to geek
Ubuntu has a dropdown menu at the top of the screen to launch applications, which is very similar to the way Windows has the start menu at the bottom of the screen. If you are a windows user new to Ubuntu, you may prefer to have the windows key launch the applications menu. Thankfully this is an easy thing to do in Ubuntu.
Go to the System \ Preferences \ Keyboard Shortcuts menu item:
Scroll down till you see the "Show the panel menu" item. Click in the Shortcut column, and when it changes to "New accelerator…", hit the Windows Key. Click the close button. You're done!
Now when you hit the windows key, the application menu will pop up. If you hit the right arrow key, you can go to the Places or System menu as well.
source: how to geek
Thursday, December 18, 2008
groups
Creating a group
To create a new group, use the groupadd command: groupadd group
where group specifies the name of the group to be added. Groups are stored in the file etc/group, which can be read by any user but modified only by root. For example, to add a group named newbies, you would enter the following command: groupadd newbies
Deleting a group
To delete a group, user the groupdel command: groupdel group
where group specifies the name of the group to be deleted. For example, to delete the group named newbies, you would enter the following command:
groupdel newbies
Adding a member to a group
To add a member to a group, you use a special form of the adduser command:adduser user group
where user specifies the member and group specifies the group to which the member is added. For example, to add the user newbie01 to the group newbies, you would enter the following command:
adduser newbie01 newbies
Removing a member from a group
Unfortunately, no command removes a user from a specified group. The easiest way to remove a member from a group is by editing the /etc/group file. Here's an excerpt from a typical /etc/group file:
users:x:100:nogroup:x:65534:bmccarty:x:1000:newbies:x:1002:newbie01,newbie02,newbie03
Each line in the file describes a single group and has the same form as other lines, consisting of a series of fields separated by colons (:). The fields are:
Group name: The name of the group.
Password: The encrypted password associated with the group. This field is not generally used, containing an x instead.
Group ID : The unique numeric ID associated with the group.
Member list
A list of user accounts, with a comma (,) separating each user account from the next.
To remove a member from a group, first create a backup copy of the /etc/group file:
cp /etc/group /etc/group.SAVE
The backup can prove helpful if you modify the file incorrectly. Next, open the /etc/group file in a text editor. Locate the line that describes the group and delete the user name and the following comma, if any. Save the file, exit the editor, and check your work.
To create a new group, use the groupadd command: groupadd group
where group specifies the name of the group to be added. Groups are stored in the file etc/group, which can be read by any user but modified only by root. For example, to add a group named newbies, you would enter the following command: groupadd newbies
Deleting a group
To delete a group, user the groupdel command: groupdel group
where group specifies the name of the group to be deleted. For example, to delete the group named newbies, you would enter the following command:
groupdel newbies
Adding a member to a group
To add a member to a group, you use a special form of the adduser command:adduser user group
where user specifies the member and group specifies the group to which the member is added. For example, to add the user newbie01 to the group newbies, you would enter the following command:
adduser newbie01 newbies
Removing a member from a group
Unfortunately, no command removes a user from a specified group. The easiest way to remove a member from a group is by editing the /etc/group file. Here's an excerpt from a typical /etc/group file:
users:x:100:nogroup:x:65534:bmccarty:x:1000:newbies:x:1002:newbie01,newbie02,newbie03
Each line in the file describes a single group and has the same form as other lines, consisting of a series of fields separated by colons (:). The fields are:
Group name: The name of the group.
Password: The encrypted password associated with the group. This field is not generally used, containing an x instead.
Group ID : The unique numeric ID associated with the group.
Member list
A list of user accounts, with a comma (,) separating each user account from the next.
To remove a member from a group, first create a backup copy of the /etc/group file:
cp /etc/group /etc/group.SAVE
The backup can prove helpful if you modify the file incorrectly. Next, open the /etc/group file in a text editor. Locate the line that describes the group and delete the user name and the following comma, if any. Save the file, exit the editor, and check your work.
Changing a User's Name
You can change the name associated with a user account, by using the chfn command:
chfn -f name userid
where name specifies the new name and userid specifies the account to be modified. If the name contains spaces or other special characters, it should be enclosed in double quotes ("). For example, to change the name associated with the account newbie to Dewbie Newbie, you would enter the following command:
chfn -f "Dewbie Newbie" newbie
chfn -f name userid
where name specifies the new name and userid specifies the account to be modified. If the name contains spaces or other special characters, it should be enclosed in double quotes ("). For example, to change the name associated with the account newbie to Dewbie Newbie, you would enter the following command:
chfn -f "Dewbie Newbie" newbie
Kernel logging with klogd
The klogd daemon records information from the kernel. These Linux kernel messages report on the kernel’s interaction with the hardware in the system — from the processor to the hard drives to the serial ports. All this information is placed in the /var/log/kern.log file.
NB: tested on ubuntu 8.04.1
NB: tested on ubuntu 8.04.1
/dev/sndstat
/dev/sndstat — This device indicates the status of the sound card.
You can determine the status of the sound card and the drivers loaded by using the
following: cat /dev/sndstat
You can determine the status of the sound card and the drivers loaded by using the
following: cat /dev/sndstat
debsums
The debsums program is a utility for Ubuntu and other Debian-based systems that checks the MD5 sums of every installed package against the md5sum files found in the /var/lib/dpkg/info directory.
Install this program with the following command: sudo aptitude install debsums
common debsums options
debsums -a Checks all files (including configuration files which are, by default, left out).
debsums –e Checks config files for packages only.
debsums –c Lists only changed files to stdout.
debsums –l Lists files that don’t have md5sum info.
debsums –s Lists only errors; otherwise be silent.
debsums Lists the packages you want debsums to analyze.
Install this program with the following command: sudo aptitude install debsums
common debsums options
debsums -a Checks all files (including configuration files which are, by default, left out).
debsums –e Checks config files for packages only.
debsums –c Lists only changed files to stdout.
debsums –l Lists files that don’t have md5sum info.
debsums –s Lists only errors; otherwise be silent.
debsums
Wednesday, December 17, 2008
Debfoster
Definition: debfoster: Install only wanted Debian packages debfoster is a wrapper program for apt and dpkg. When first run, it will ask you which of the installed packages you want to keep installed. After that, it maintains a list of packages that you want to have installed on your system. It uses this list to detect packages that have been installed only because other packages depended on them. If one of these dependencies changes, debfoster will take notice, and ask if you want to remove the old package. This helps you to maintain a clean Debian install, without old (mainly library) packages lying around that aren't used any more.
Once in a while, you may want to do some maintenance on your Ubuntu machine and clean up unnecessary files that are chunking up large storage space in your hard disk.
Debfoster creates a dependency files to enable you to keep track of what you have installed. When you uninstall an application, it will check for any leave behind dependencies files or orphaned packages and ask you if you want to remove it.
Install debfoster, or via the terminal,
sudo apt-get install debfoster
Creating the initial keeper file:
sudo debfoster -q
Force the system to conform to the keeper file
sudo debfoster -f
If you have some packages that you never want to uninstall and do not want debfoster to handle those packages, you can edit the keeper file and remove those packages from the list.
gksu gedit /var/lib/debfoster/keepers
To see is there is any orphaned package or dependencies files that need to be removed:
sudo debfoster
NB:- verified on ubuntu 8.04
Source: Debian 3.0r0 APT / Linux Dictionary V 0.16
http://www.tldp.org/LDP/Linux-Dictionary/html/index.html
http://maketecheasier.com/8-ways-to-maintain-a-clean-lean-ubuntu-machine/2008/10/07
Once in a while, you may want to do some maintenance on your Ubuntu machine and clean up unnecessary files that are chunking up large storage space in your hard disk.
Debfoster creates a dependency files to enable you to keep track of what you have installed. When you uninstall an application, it will check for any leave behind dependencies files or orphaned packages and ask you if you want to remove it.
Install debfoster, or via the terminal,
sudo apt-get install debfoster
Creating the initial keeper file:
sudo debfoster -q
Force the system to conform to the keeper file
sudo debfoster -f
If you have some packages that you never want to uninstall and do not want debfoster to handle those packages, you can edit the keeper file and remove those packages from the list.
gksu gedit /var/lib/debfoster/keepers
To see is there is any orphaned package or dependencies files that need to be removed:
sudo debfoster
NB:- verified on ubuntu 8.04
Source: Debian 3.0r0 APT / Linux Dictionary V 0.16
http://www.tldp.org/LDP/Linux-Dictionary/html/index.html
http://maketecheasier.com/8-ways-to-maintain-a-clean-lean-ubuntu-machine/2008/10/07
Tuesday, December 16, 2008
/usr/share
sulekha
the following is the explanation i have read about /usr/share in a book
Data for installed applications that is architecture−independent and can be shared between systems. A number of subdirectories with equivalents in `/usr' also appear here, including `/usr/share/doc', `/usr/share/info', and `/usr/share/icons'.
how correct is this explanation ?
secesh
http://tldp.org/HOWTO/HighQuality-Apps-HOWTO/fhs.html
Quote:
/usr/share/doc, /usr/share/man
The "share" word is used because what is under /usr/share is platform independent, and can be shared among several machines across a network filesystem. Therefore this is the place for manuals, documentations, examples etc.
I'd say your explanation is fairly good.
ryedunn
That being said, would it be purdent for me to store my music files in /usr/share/mp3 on a server?
I know many people might want to put these in a /home dir but which would best follow the FHS?
Lew pitcher
I believe that /usr/local/share/mp3 would be the canonical directory to use.The /usr/local tree is reserved for /local/ files (that is, files that are not derived from, or manipulated by the distribution or it's installers) that can be shared between users and processes
dave
In an ideal world it should still be a separate partition so that it can survive an OS upgrade/reinstall. When I upgrade Fedora I usually let it format everything except the /home partition to make sure it's a clean install. Having a partition mounted at /usr/local/share/mp3 would also work.
snova
No better. Use your home directory.
The /usr/local tree is identical (well, almost) to the /usr tree. The sole difference is that /usr is meant for the package manager, and /usr/local is meant for programs you install yourself.
Programs, not data. Never put any personal files outside of your home directory.
tim greer
You don't need to store any file in any specific area, though some common paths for some specific types of files are usually best. For files such as mp3 files, however, there's no specific area, but I'd personally store them in a home directory or some such similar area.If you plan to share those files with other users on the system, than that's different. If you want to store them for personal use/reasons, store them in your home directory. I don't believe the FHS is relevant
for audio files, again, unless you intend to provide some (possibly default) access to other users on a shared server.
darren salt
I'd say so; something like /usr/local/share/mp3 or /srv/mp3, I think.
nevrial
You can put them there, but then remember to chmod them properly so that no one having access to it erases it.
laurenz albe
The file system hierarchy is a guideline rather than a codex, and it's largely a matter of taste where you put a certain data file.
The idea is that /home is for everything that belongs to a certain user,and /usr/share is stuff that is useful for everybody.
One guideline is maybe that a file in /usr/share should belong to root -it should be stuff that is here to stay and not be changed on the whim
of a user.
So if you have a constant set of mp3 files that every user can depend on, /usr/share/mp3 doesn't sound wrong. On the other hand, if you add and delete mp3 files all the time (I hope you are not root when you acquire them), they should be stored in a directory that belongs to a mortal user (under /home).
noiance
HELL NO!!!
If you upgrade or switch your OS bye, bye bye MP3s if you didn't make a backup.
IMHO, /home/MP3 would be the correct place for sharing the mp3s on the server. Change the permission and share options to allow access to /home/MP3.
cariboo907
/usr is not the place to store normal user accessable files. The directory is for executeables, the libraries they need, configuration files and documentation. I would suggest putting your mp3 files in a subdirectory of /home, like /home/mp3 then you can set the permission of the directory to world readable with having to worry about accidentally changine permissions of a directory in /usr, the may hose your installation.
dcstar
Quite right, never EVER use system directories for user files.
People, you have a system (Linux) that is flexible and allows you to do stupid things as well as intelligent things, so don't do stupid things by mucking around with system directories and files because they contain a name that saves you typing a few characters somewhere else.
Just read some of the posts in forums like this - bemoaning their loss of data/having to reinstall their system - if you need a lesson in never tampering in places that you shouldn't.
the following is the explanation i have read about /usr/share in a book
Data for installed applications that is architecture−independent and can be shared between systems. A number of subdirectories with equivalents in `/usr' also appear here, including `/usr/share/doc', `/usr/share/info', and `/usr/share/icons'.
how correct is this explanation ?
secesh
http://tldp.org/HOWTO/HighQuality-Apps-HOWTO/fhs.html
Quote:
/usr/share/doc, /usr/share/man
The "share" word is used because what is under /usr/share is platform independent, and can be shared among several machines across a network filesystem. Therefore this is the place for manuals, documentations, examples etc.
I'd say your explanation is fairly good.
ryedunn
That being said, would it be purdent for me to store my music files in /usr/share/mp3 on a server?
I know many people might want to put these in a /home dir but which would best follow the FHS?
Lew pitcher
I believe that /usr/local/share/mp3 would be the canonical directory to use.The /usr/local tree is reserved for /local/ files (that is, files that are not derived from, or manipulated by the distribution or it's installers) that can be shared between users and processes
dave
In an ideal world it should still be a separate partition so that it can survive an OS upgrade/reinstall. When I upgrade Fedora I usually let it format everything except the /home partition to make sure it's a clean install. Having a partition mounted at /usr/local/share/mp3 would also work.
snova
No better. Use your home directory.
The /usr/local tree is identical (well, almost) to the /usr tree. The sole difference is that /usr is meant for the package manager, and /usr/local is meant for programs you install yourself.
Programs, not data. Never put any personal files outside of your home directory.
tim greer
You don't need to store any file in any specific area, though some common paths for some specific types of files are usually best. For files such as mp3 files, however, there's no specific area, but I'd personally store them in a home directory or some such similar area.If you plan to share those files with other users on the system, than that's different. If you want to store them for personal use/reasons, store them in your home directory. I don't believe the FHS is relevant
for audio files, again, unless you intend to provide some (possibly default) access to other users on a shared server.
darren salt
I'd say so; something like /usr/local/share/mp3 or /srv/mp3, I think.
nevrial
You can put them there, but then remember to chmod them properly so that no one having access to it erases it.
laurenz albe
The file system hierarchy is a guideline rather than a codex, and it's largely a matter of taste where you put a certain data file.
The idea is that /home is for everything that belongs to a certain user,and /usr/share is stuff that is useful for everybody.
One guideline is maybe that a file in /usr/share should belong to root -it should be stuff that is here to stay and not be changed on the whim
of a user.
So if you have a constant set of mp3 files that every user can depend on, /usr/share/mp3 doesn't sound wrong. On the other hand, if you add and delete mp3 files all the time (I hope you are not root when you acquire them), they should be stored in a directory that belongs to a mortal user (under /home).
noiance
HELL NO!!!
If you upgrade or switch your OS bye, bye bye MP3s if you didn't make a backup.
IMHO, /home/MP3 would be the correct place for sharing the mp3s on the server. Change the permission and share options to allow access to /home/MP3.
cariboo907
/usr is not the place to store normal user accessable files. The directory is for executeables, the libraries they need, configuration files and documentation. I would suggest putting your mp3 files in a subdirectory of /home, like /home/mp3 then you can set the permission of the directory to world readable with having to worry about accidentally changine permissions of a directory in /usr, the may hose your installation.
dcstar
Quite right, never EVER use system directories for user files.
People, you have a system (Linux) that is flexible and allows you to do stupid things as well as intelligent things, so don't do stupid things by mucking around with system directories and files because they contain a name that saves you typing a few characters somewhere else.
Just read some of the posts in forums like this - bemoaning their loss of data/having to reinstall their system - if you need a lesson in never tampering in places that you shouldn't.
/usr/share/calendar
The following table gives the name of each calendar file and describes its contents.
calendar.debian Interesting dates around Debian collected at Infodrom
calendar.ubuntu Interesting dates in Ubuntu history
calendar.birthday Births and deaths of famous people.
calendar.christian Christian holidays.
calendar.computer Significant dates in the history of computing.
calendar.history Dates of U.S. historical events.
calendar.holiday Standard and obscure holidays.
calendar.judaic Jewish holidays.
calendar.music Dates related to music, mostly 1960s rock and roll.
NB: tested on ubuntu 8.04.1
calendar.debian Interesting dates around Debian collected at Infodrom
calendar.ubuntu Interesting dates in Ubuntu history
calendar.birthday Births and deaths of famous people.
calendar.christian Christian holidays.
calendar.computer Significant dates in the history of computing.
calendar.history Dates of U.S. historical events.
calendar.holiday Standard and obscure holidays.
calendar.judaic Jewish holidays.
calendar.music Dates related to music, mostly 1960s rock and roll.
NB: tested on ubuntu 8.04.1
Wednesday, December 10, 2008
arping
Finding Duplicate IP Addresses
You want to know how to test an IP address on your LAN to see whether it is a duplicate.
Solution
Use arping, like this:
$ arping -D 192.168.1.76
ARPING 192.168.1.76 from 0.0.0.0 eth0
Unicast reply from 192.168.1.76 [00:14:2A:54:67:D6] for 192.168.1.76 [00:14:2A:54:67:
D6] 0.605ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
Received 1 response(s) means that this address is already in use, and arping even gives you the MAC address. You may also test with a hostname:
$ arping -D uberpc
ARPING 192.168.1.76 from 0.0.0.0 eth0
Unicast reply from 192.168.1.76 [00:14:2A:54:67:D6] for 192.168.1.76 [00:14:2A:54:67:
D6] 0.590ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
You should set a time limit or count limit, or arping will keep running when it gets no response. This example sets a time limit of 10 seconds:
$ arping -w10 -D 192.168.1.100
ARPING 192.168.1.100 from 0.0.0.0 eth0
Sent 11 probes (11 broadcast(s))
Received 0 response(s)
Use -c5 instead of -w10 to tell arping to run for five counts.
if you have intermittent connectivity problems with a particular host , run arping to see if it has a duplicate address
arping will work when ping fails.
source:- carla schroder
You want to know how to test an IP address on your LAN to see whether it is a duplicate.
Solution
Use arping, like this:
$ arping -D 192.168.1.76
ARPING 192.168.1.76 from 0.0.0.0 eth0
Unicast reply from 192.168.1.76 [00:14:2A:54:67:D6] for 192.168.1.76 [00:14:2A:54:67:
D6] 0.605ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
Received 1 response(s) means that this address is already in use, and arping even gives you the MAC address. You may also test with a hostname:
$ arping -D uberpc
ARPING 192.168.1.76 from 0.0.0.0 eth0
Unicast reply from 192.168.1.76 [00:14:2A:54:67:D6] for 192.168.1.76 [00:14:2A:54:67:
D6] 0.590ms
Sent 1 probes (1 broadcast(s))
Received 1 response(s)
You should set a time limit or count limit, or arping will keep running when it gets no response. This example sets a time limit of 10 seconds:
$ arping -w10 -D 192.168.1.100
ARPING 192.168.1.100 from 0.0.0.0 eth0
Sent 11 probes (11 broadcast(s))
Received 0 response(s)
Use -c5 instead of -w10 to tell arping to run for five counts.
if you have intermittent connectivity problems with a particular host , run arping to see if it has a duplicate address
arping will work when ping fails.
source:- carla schroder
Tuesday, December 9, 2008
lanmap utility
Lanmap Listens to all available traffic on the interface of your choice, figures out who’s talking to who, how much, using which protocols.
This information is then put into a nice human-readable 2d image (various formats are available) which can be used to understand a network’s topology.
Install lanmap in Ubuntu
sudo apt-get install lanmap
This will complete the installation
Using lanmap
lanmap syntax
lanmap [-o directory] [-e program] [-T {png,gif,svg}] [-f filtetr] [-D {#,all,raw}] [-r seconds]
[-i {?,*wildcard*,iface}] [-h] [-v] [-V]
lanmap example
lanmap -i eth0 -r 30 -T png -o /tmp/
This will create a lanmap.png file under tmp folder
download lanmap from here http://www.parseerror.com/lanmap/
source : ubuntugeek
This information is then put into a nice human-readable 2d image (various formats are available) which can be used to understand a network’s topology.
Install lanmap in Ubuntu
sudo apt-get install lanmap
This will complete the installation
Using lanmap
lanmap syntax
lanmap [-o directory] [-e program] [-T {png,gif,svg}] [-f filtetr] [-D {#,all,raw}] [-r seconds]
[-i {?,*wildcard*,iface}] [-h] [-v] [-V]
lanmap example
lanmap -i eth0 -r 30 -T png -o /tmp/
This will create a lanmap.png file under tmp folder
download lanmap from here http://www.parseerror.com/lanmap/
source : ubuntugeek
Linux IP Command Lines
Display Current Config for all NIC's: ifconfig
syntax:- ifconfig dev ip netmask broadcast
Display Current Config for eth0: ifconfig eth0
Assign IP: ifconfig eth0 192.168.1.2
Assign IP/Subnet: ifconfig eth0 192.168.1.2 netmask 255.255.255.0
Assign Default Gateway: route add default gw 192.168.1.1
Assign multiple IP's: ifconfig eth0:0 192.168.1.2
Assign second IP: ifconfig eth0:1 192.168.1.3
Disable network card: ifconfig eth0 down
Enable network card: ifconfig eth0 up
View current routing table: route "or" route -n
View arp cache: arp "or" arp -n
Ping: ping -c 3 192.168.1.1
Trace Route: traceroute www.whatismyip.com
Trace Path: tracepath www.whatismyip.com
DNS Test: host www.whatismyip.com
Advanced DNS Test: dig www.whatismyip.com
Reverse Lookup: host 66.11.119.69
Advanced Reverse Lookup: dig -x 66.11.119.69
NB:- Warning untested
Setting Up NICs under Fedora and RHEL
Fedora and other Red Hat–type systems use a simple setup that makes it easy to configure network cards at boot time. It is done through the creation of files in the /etc/sysconfig/network-scripts directory that are read at boot time. All of the graphical tools
under Fedora create and manage these files for you; for other people who like to get under the hood, the following sections show how to manually manage the configuration files.
For each network interface, there is an ifcfg file in /etc/sysconfig/network-scripts.
This filename is suffixed by the name of the device; thus, ifcfg-eth0 is for the eth0 device,ifcfg-eth1 is for the eth1 device, and so on.
If you choose to use a static IP address at installation time, the format for the interface configuration file for eth0 will be as follows:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
NETMASK=255.255.255.0
IPADDR= 192.168.1.100
GATEWAY=192.168.1.1
TYPE=Ethernet
HWADDR=00:0c:29:ac:5b:cd
TIP In Fedora, Red Hat Enterprise Linux (RHEL), and Centos distros, the file /usr/share/doc/initscripts-*/sysconfig.txt explains the options and variables that can be used in the “/etc/sysconfig/network-scripts/ifcfg-*”, among other things.
syntax:- ifconfig dev ip netmask broadcast
Display Current Config for eth0: ifconfig eth0
Assign IP: ifconfig eth0 192.168.1.2
Assign IP/Subnet: ifconfig eth0 192.168.1.2 netmask 255.255.255.0
Assign Default Gateway: route add default gw 192.168.1.1
Assign multiple IP's: ifconfig eth0:0 192.168.1.2
Assign second IP: ifconfig eth0:1 192.168.1.3
Disable network card: ifconfig eth0 down
Enable network card: ifconfig eth0 up
View current routing table: route "or" route -n
View arp cache: arp "or" arp -n
Ping: ping -c 3 192.168.1.1
Trace Route: traceroute www.whatismyip.com
Trace Path: tracepath www.whatismyip.com
DNS Test: host www.whatismyip.com
Advanced DNS Test: dig www.whatismyip.com
Reverse Lookup: host 66.11.119.69
Advanced Reverse Lookup: dig -x 66.11.119.69
NB:- Warning untested
Setting Up NICs under Fedora and RHEL
Fedora and other Red Hat–type systems use a simple setup that makes it easy to configure network cards at boot time. It is done through the creation of files in the /etc/sysconfig/network-scripts directory that are read at boot time. All of the graphical tools
under Fedora create and manage these files for you; for other people who like to get under the hood, the following sections show how to manually manage the configuration files.
For each network interface, there is an ifcfg file in /etc/sysconfig/network-scripts.
This filename is suffixed by the name of the device; thus, ifcfg-eth0 is for the eth0 device,ifcfg-eth1 is for the eth1 device, and so on.
If you choose to use a static IP address at installation time, the format for the interface configuration file for eth0 will be as follows:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
NETMASK=255.255.255.0
IPADDR= 192.168.1.100
GATEWAY=192.168.1.1
TYPE=Ethernet
HWADDR=00:0c:29:ac:5b:cd
TIP In Fedora, Red Hat Enterprise Linux (RHEL), and Centos distros, the file /usr/share/doc/initscripts-*/sysconfig.txt explains the options and variables that can be used in the “/etc/sysconfig/network-scripts/ifcfg-*”, among other things.
![]() |
| From linux news |
Monday, December 8, 2008
mac fonts in ubuntu
Want these mac fonts?
AppleGaramond
Aquabase
LITHOGRL
Lucida Grande
Lucida Mac
lucon
MacGrand
If you do follow me, I'll show you how easy it is to install them!
Open up a terminal:
Applications->Accessories->Terminal
Copy/paste these commands:
wget http://ubuntu-debs.googlecode.com/files/macfonts.tar.gz
tar zxvf macfonts.tar.gz
sudo mv macfonts /usr/share/fonts/
sudo fc-cache -f -v
Now the Mac Fonts are installed, if you like these fonts and want them to be the default gnome font, right click on your desktop and select Change Desktop Backround then click on Fonts, and you can customize your system fonts there.
collin henderson
This is terrific .... I love my linux (new ubuntu user - one year) but hate the fonts. Have tired the MS TT''s but this result is exceptional, and I will stick with mac fonts. Also found this to help to know which ones are for where:
You can choose the fonts from:
System -> Preferences -> appearances -> Font
From Font Preferences, I choose these following fonts:
* Application font: Lucida Grande 9
* Document font: Lucida Grande 9
* Desktop font: MACGrande 9
* Window title font: LucidaMacBold
* Fixed width font: Lucida Console
john nillson
To get the fonts to render really nice you have to change two settings wrt to font rendering
1. Enable subpixel rednering
2. Disable all hinting
The first option make sure the highest possible resolution is used when deciding how the pixels should be colored.
The second option disable alignment on pixel edges. In theory hinting should make the font easier to read on a monitor, but in practice I find it easier to read if the font alignment just ignore the pixels. They get somewhat blurrier, but at the same time the blurriness makes them softer and thus easier on the eye.
kahrytan
Better yet, Extract to ~/.fonts folder. no need to place them in /usr/share/fonts
source ubuntu unleashed
NB tested in ubuntu 8.04.1
AppleGaramond
Aquabase
LITHOGRL
Lucida Grande
Lucida Mac
lucon
MacGrand
If you do follow me, I'll show you how easy it is to install them!
Open up a terminal:
Applications->Accessories->Terminal
Copy/paste these commands:
wget http://ubuntu-debs.googlecode.com/files/macfonts.tar.gz
tar zxvf macfonts.tar.gz
sudo mv macfonts /usr/share/fonts/
sudo fc-cache -f -v
Now the Mac Fonts are installed, if you like these fonts and want them to be the default gnome font, right click on your desktop and select Change Desktop Backround then click on Fonts, and you can customize your system fonts there.
collin henderson
This is terrific .... I love my linux (new ubuntu user - one year) but hate the fonts. Have tired the MS TT''s but this result is exceptional, and I will stick with mac fonts. Also found this to help to know which ones are for where:
You can choose the fonts from:
System -> Preferences -> appearances -> Font
From Font Preferences, I choose these following fonts:
* Application font: Lucida Grande 9
* Document font: Lucida Grande 9
* Desktop font: MACGrande 9
* Window title font: LucidaMacBold
* Fixed width font: Lucida Console
john nillson
To get the fonts to render really nice you have to change two settings wrt to font rendering
1. Enable subpixel rednering
2. Disable all hinting
The first option make sure the highest possible resolution is used when deciding how the pixels should be colored.
The second option disable alignment on pixel edges. In theory hinting should make the font easier to read on a monitor, but in practice I find it easier to read if the font alignment just ignore the pixels. They get somewhat blurrier, but at the same time the blurriness makes them softer and thus easier on the eye.
kahrytan
Better yet, Extract to ~/.fonts folder. no need to place them in /usr/share/fonts
source ubuntu unleashed
NB tested in ubuntu 8.04.1
Friday, December 5, 2008
/proc/sys/vm/drop_caches
what exactly is the purpose of /proc/sys/vm/drop_caches file ?
can any one give a practical situation where the tip given in the following how to is used ?
In the past, I've been forced to do ridiculous things like cat a file larger than available RAM to /dev/null and edit gigabyte files which flood my cache with this data. Luckily, Linux kernels 2.6.16 and newer provide a mechanism to clear the inode, page, and dentry caches on demand avoiding all this headache. All you have to do is echo a value to the proc filesystem, and you're done.
To use /proc/sys/vm/drop_caches, just echo a number to it.
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation and dirty objects are not freeable, the user should run "sync" first!
This was originally found @ http://www.linuxinsight.com/proc_sys_vm_drop_caches.html
ilikejam
The only time I've ever seen anyone use this is when doing I/O benchmarking - dropping the caches forces disk operations to happen on the disk instead of in RAM.
can any one give a practical situation where the tip given in the following how to is used ?
In the past, I've been forced to do ridiculous things like cat a file larger than available RAM to /dev/null and edit gigabyte files which flood my cache with this data. Luckily, Linux kernels 2.6.16 and newer provide a mechanism to clear the inode, page, and dentry caches on demand avoiding all this headache. All you have to do is echo a value to the proc filesystem, and you're done.
To use /proc/sys/vm/drop_caches, just echo a number to it.
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation and dirty objects are not freeable, the user should run "sync" first!
This was originally found @ http://www.linuxinsight.com/proc_sys_vm_drop_caches.html
ilikejam
The only time I've ever seen anyone use this is when doing I/O benchmarking - dropping the caches forces disk operations to happen on the disk instead of in RAM.
Wednesday, December 3, 2008
linux installation in a logical partition ?
sulekha
1. why is it said that linux should always be installed in primary partitions ?
2. what is the trade off between installing linux on a primary partition and installing linux on a logical partition, is there any performance issues ?
3.is there really a concept of logical partition , since there are only 4 primary partitions and one of them is treated as extended partition which can contain any no: of logical partitions ?
syg00
1) Who said that ? (it's rubbish BTW)
2) Nope.
brianL
Debian testing is running just fine in a logical partition for me.No tradeoff. It's Windows and the BSDs that have to be on a primary partition.
billymayday
3 isn't true anyway - sata can have total of 16 partitions (or is it 15?), ide was 64 from memory
sulekha
Oh you mean the nof logical partitions. in SATA which value is correct 2^4 or 2^4 - 1 , BTW how did IDE or PATA drives get the value 64 ?
1. why is it said that linux should always be installed in primary partitions ?
2. what is the trade off between installing linux on a primary partition and installing linux on a logical partition, is there any performance issues ?
3.is there really a concept of logical partition , since there are only 4 primary partitions and one of them is treated as extended partition which can contain any no: of logical partitions ?
syg00
1) Who said that ? (it's rubbish BTW)
2) Nope.
brianL
Debian testing is running just fine in a logical partition for me.No tradeoff. It's Windows and the BSDs that have to be on a primary partition.
billymayday
3 isn't true anyway - sata can have total of 16 partitions (or is it 15?), ide was 64 from memory
sulekha
Oh you mean the nof logical partitions. in SATA which value is correct 2^4 or 2^4 - 1 , BTW how did IDE or PATA drives get the value 64 ?
Friday, November 28, 2008
Linux starting points........
In recent years a number of corporations have poured millions of dollars into creating Windows-like user interfaces for Linux, and into persuading the various major distros to adopt them.
See this article, for example:
http://troy-at-kde.livejournal.com/14690.html
There you have the owner of Slackware and his cronies being wined and dined by kde at a supposed "conference", which is just a way of disguising an expensive vacation. A bribe.
Primarily, I'm talking about kde, to a lesser degree, gnome. There's also one called xfce, and maybe a couple of other even lesser ones.
Henceforth, I'm just going to refer to kde, but I mean all of them.
Why are they doing this? Because they are threatened by people running a free operating system who actually understand how it works.
By people who don't need _them_. Who aren't _controlled_ by them.
You can let them lead you by the nose to kde and pretend that you are running Linux, but you won't be. You'll be letting kde run Linux for you. You'll be letting the corporations _behind_ kde
run Linux for you.
Ironically, it takes just as long to learn to use kde as it does to learn to run Linux from the shell, the commandline.
Myself and many others do this, and we can do anything that someone running kde can do. And a lot more.
The kde technocrats want you to think that Linux is so complicated that no mere mortal can comprehend it, and when you add kde to Linux (which more than doubles its size) it does indeed become too complex to deal with. How about that? :-)
But tens of of thousands of ordinary people managed to run Linux just fine before kde existed. And they didn't have anywhere near the documentation that's available now. Tens of thousands of
people _still_ run Linux from the commandline.
If you are thinking that running Linux from the commandline means spending all of your time typing in long commands, then you are quite mistaken. If you are thinking that it means you won't be able to run your favorite graphical applications and use a mouse, you are quite mistaken.
Two parallel courses of study are involved here: Learning the basics of how Linux works, and learning the basics of the shell,bash being the most common one these days.
We are all different; we are all individuals. We each need a unique user interface tailored to _our_ specific needs. And it is _easy_ to create one with just a little knowledge of bash.
Here are three excellent documents to get you on the path of freedom and power, to learning Linux instead of some artificial user interface:
The first section of this one is actually an introduction to the real basics of bash, how to use the command line. It's section on mathematical tools is not so hot.
See: http://groups.google.com/group/alt.linux/msg/208349400085e7a3
http://www.tldp.org/LDP/GNU-Linux-Tools-Summary/GNU-Linux-Tools-Summa...
How Linux actually works:
http://www.tldp.org/LDP/intro-linux/intro-linux.html.tar.gz
Basic shell scripting, etc:
http://www.tldp.org/LDP/Bash-Beginners-Guide/Bash-Beginners-Guide.htm...
These are basic reference documents:
This one is dated, but still very useful:
http://rute.2038bug.com/rute.html.tar.bz2
Don't let the word "advanced" throw you. There are many basic things covered in this fine work:
http://www.tldp.org/LDP/abs/abs-guide.html.tar.gz
These are good reference sites:
http://www.comptechdoc.org/os/linux/
http://www.tldp.org/LDP/Linux-Dictionary/html/index.html
http://linux-newbie.sunsite.dk/index.html
There is a free, online school for newbies out there, but I've
checked it out and wasn't much impressed.
---------------------------------------------------
I'm looking for people to teach the newbies, and for newbies who
want to learn to run Linux from the command line.
I am not interested in getting involved in running arguments
about the points I've raised.
If you disagree with me, simply post your opinions and others
will read them. You are entitled to them.
I will not be responding any more posts of an argumentative nature.
The usenet has thousands of people who will argue anything from
now until eternity. That's their thing. I have better things to
do.
See this article, for example:
http://troy-at-kde.livejournal.com/14690.html
There you have the owner of Slackware and his cronies being wined and dined by kde at a supposed "conference", which is just a way of disguising an expensive vacation. A bribe.
Primarily, I'm talking about kde, to a lesser degree, gnome. There's also one called xfce, and maybe a couple of other even lesser ones.
Henceforth, I'm just going to refer to kde, but I mean all of them.
Why are they doing this? Because they are threatened by people running a free operating system who actually understand how it works.
By people who don't need _them_. Who aren't _controlled_ by them.
You can let them lead you by the nose to kde and pretend that you are running Linux, but you won't be. You'll be letting kde run Linux for you. You'll be letting the corporations _behind_ kde
run Linux for you.
Ironically, it takes just as long to learn to use kde as it does to learn to run Linux from the shell, the commandline.
Myself and many others do this, and we can do anything that someone running kde can do. And a lot more.
The kde technocrats want you to think that Linux is so complicated that no mere mortal can comprehend it, and when you add kde to Linux (which more than doubles its size) it does indeed become too complex to deal with. How about that? :-)
But tens of of thousands of ordinary people managed to run Linux just fine before kde existed. And they didn't have anywhere near the documentation that's available now. Tens of thousands of
people _still_ run Linux from the commandline.
If you are thinking that running Linux from the commandline means spending all of your time typing in long commands, then you are quite mistaken. If you are thinking that it means you won't be able to run your favorite graphical applications and use a mouse, you are quite mistaken.
Two parallel courses of study are involved here: Learning the basics of how Linux works, and learning the basics of the shell,bash being the most common one these days.
We are all different; we are all individuals. We each need a unique user interface tailored to _our_ specific needs. And it is _easy_ to create one with just a little knowledge of bash.
Here are three excellent documents to get you on the path of freedom and power, to learning Linux instead of some artificial user interface:
The first section of this one is actually an introduction to the real basics of bash, how to use the command line. It's section on mathematical tools is not so hot.
See: http://groups.google.com/group/alt.linux/msg/208349400085e7a3
http://www.tldp.org/LDP/GNU-Linux-Tools-Summary/GNU-Linux-Tools-Summa...
How Linux actually works:
http://www.tldp.org/LDP/intro-linux/intro-linux.html.tar.gz
Basic shell scripting, etc:
http://www.tldp.org/LDP/Bash-Beginners-Guide/Bash-Beginners-Guide.htm...
These are basic reference documents:
This one is dated, but still very useful:
http://rute.2038bug.com/rute.html.tar.bz2
Don't let the word "advanced" throw you. There are many basic things covered in this fine work:
http://www.tldp.org/LDP/abs/abs-guide.html.tar.gz
These are good reference sites:
http://www.comptechdoc.org/os/linux/
http://www.tldp.org/LDP/Linux-Dictionary/html/index.html
http://linux-newbie.sunsite.dk/index.html
There is a free, online school for newbies out there, but I've
checked it out and wasn't much impressed.
---------------------------------------------------
I'm looking for people to teach the newbies, and for newbies who
want to learn to run Linux from the command line.
I am not interested in getting involved in running arguments
about the points I've raised.
If you disagree with me, simply post your opinions and others
will read them. You are entitled to them.
I will not be responding any more posts of an argumentative nature.
The usenet has thousands of people who will argue anything from
now until eternity. That's their thing. I have better things to
do.
Thursday, November 27, 2008
Checking for suspicious account use
sulekha
the following is the recipe which i saw in Linux security cookbook
Checking for Suspicious Account Use
Problem
You want to discover unusual or dangerous usage of accounts on your system: dormant user accounts, recent logins to system accounts, etc.
Solution
To print information about the last login for each user:
$ lastlog [-u username]
To print the entire login history:
$ last [username]
To print failed login attempts:
$ lastb [username]
To enable recording of bad logins:
# touch /var/log/btmp
# chown --reference=/var/log/wtmp /var/log/btmp
# chmod --reference=/var/log/wtmp /var/log/btmp
how correct is this recipe? what are the modifications/changes that needs to made so as to make it work in ubuntu 8.04.1
ibutho
It seems accurate to me and the only modification you may need to do is prefix individual commands with sudo. /var/log/btmp stores all the last bad logins, but in most distros its not created by default. If you run "lastb", a list of all bad logins since you created /var/log/btmp will be shown. For a specific user, its "lastb user".
cariboo907
/var/log/btmp have been atomagically created on all the Debian based distro I have used.
the following is the recipe which i saw in Linux security cookbook
Checking for Suspicious Account Use
Problem
You want to discover unusual or dangerous usage of accounts on your system: dormant user accounts, recent logins to system accounts, etc.
Solution
To print information about the last login for each user:
$ lastlog [-u username]
To print the entire login history:
$ last [username]
To print failed login attempts:
$ lastb [username]
To enable recording of bad logins:
# touch /var/log/btmp
# chown --reference=/var/log/wtmp /var/log/btmp
# chmod --reference=/var/log/wtmp /var/log/btmp
how correct is this recipe? what are the modifications/changes that needs to made so as to make it work in ubuntu 8.04.1
ibutho
It seems accurate to me and the only modification you may need to do is prefix individual commands with sudo. /var/log/btmp stores all the last bad logins, but in most distros its not created by default. If you run "lastb", a list of all bad logins since you created /var/log/btmp will be shown. For a specific user, its "lastb user".
cariboo907
/var/log/btmp have been atomagically created on all the Debian based distro I have used.
hidden files in home directory
sulekha
can anyone explain me the purpose of the following hidden files which are usually seen in the home directory ?
.Xauthority
.xsession-errors
.recently-used-xbel
.recently-used
.pulse-cookie
.lesshst
.ICEauthority
.gksu.lock
.esd_auth
aarklon
The `.xsession' file, a hidden file in your home directory, specifies the clients that are automatically run when your X session first starts. It is just a shell script, usually containing a list of clients to run. You can edit your `.xsession' file in a text editor, and if this
file doesn't exist, you can create it.
Fritz monroe
I don't have details, but it's a place for you to start digging.
.Xauthority - X11 forwarding related
.xsession-errors - holds errors caused during the start of X Windows
.recently-used - Gnome's recently opened documents (Places >> Recent Documents)
.pulse-cookie - maybe pulseaudio related?
.lesshst - no idea
.ICEauthority - don't know
.gksu.lock - this is a lock file for gksu (Gtk+ frontend to su and sudo)
.esd_auth - something to do with the esd sound system.
.recently-used-xbel - not sure, seems to be GIMP related. So probably the GIMP recently opened images
Sidney Lambe
$ apropos Xauthority
Xauthority: nothing appropriate
$ apropos authority
Xau library: XauFileName [Xau] (3) - X authority database routines
XauDisposeAuth [Xau] (3) - X authority database routines
XauGetAuthByAddr [Xau] (3) - X authority database routines
XauGetBestAuthByAddr [Xau] (3) - X authority database routines
XauLockAuth [Xau] (3) - X authority database routines
XauReadAuth [Xau] (3) - X authority database routines
XauUnlockAuth [Xau] (3) - X authority database routines
XauWriteAuth [Xau] (3) - X authority database routines
iceauth (1x) - ICE authority file utility
xauth (1) - X authority file utility
And that last entry looks pretty promising.
$ man xauth
There's your answer, on your own box, right under your nose.
Mark Hobley
Maybe we need some more manual pages:
man .Xauthority
No manual entry for .Xauthority
man .xsession-errors
No manual entry for .xsession-errors
We have one for xsession, but it contains capitalized names. I don't know why we do this. The capital X is probably something to do with the X windowing system (or should that be the x windowing system? Hmmm, should we be using uppercase first letters for executables? Yuck! Letter
case adds to the confusion here).
man xsession
Xsession(5)
NAME
Xsession - initialize X session
N.B:- Tested in ubuntu 8.04.1
can anyone explain me the purpose of the following hidden files which are usually seen in the home directory ?
.Xauthority
.xsession-errors
.recently-used-xbel
.recently-used
.pulse-cookie
.lesshst
.ICEauthority
.gksu.lock
.esd_auth
aarklon
The `.xsession' file, a hidden file in your home directory, specifies the clients that are automatically run when your X session first starts. It is just a shell script, usually containing a list of clients to run. You can edit your `.xsession' file in a text editor, and if this
file doesn't exist, you can create it.
Fritz monroe
I don't have details, but it's a place for you to start digging.
.Xauthority - X11 forwarding related
.xsession-errors - holds errors caused during the start of X Windows
.recently-used - Gnome's recently opened documents (Places >> Recent Documents)
.pulse-cookie - maybe pulseaudio related?
.lesshst - no idea
.ICEauthority - don't know
.gksu.lock - this is a lock file for gksu (Gtk+ frontend to su and sudo)
.esd_auth - something to do with the esd sound system.
.recently-used-xbel - not sure, seems to be GIMP related. So probably the GIMP recently opened images
Sidney Lambe
$ apropos Xauthority
Xauthority: nothing appropriate
$ apropos authority
Xau library: XauFileName [Xau] (3) - X authority database routines
XauDisposeAuth [Xau] (3) - X authority database routines
XauGetAuthByAddr [Xau] (3) - X authority database routines
XauGetBestAuthByAddr [Xau] (3) - X authority database routines
XauLockAuth [Xau] (3) - X authority database routines
XauReadAuth [Xau] (3) - X authority database routines
XauUnlockAuth [Xau] (3) - X authority database routines
XauWriteAuth [Xau] (3) - X authority database routines
iceauth (1x) - ICE authority file utility
xauth (1) - X authority file utility
And that last entry looks pretty promising.
$ man xauth
There's your answer, on your own box, right under your nose.
Mark Hobley
Maybe we need some more manual pages:
man .Xauthority
No manual entry for .Xauthority
man .xsession-errors
No manual entry for .xsession-errors
We have one for xsession, but it contains capitalized names. I don't know why we do this. The capital X is probably something to do with the X windowing system (or should that be the x windowing system? Hmmm, should we be using uppercase first letters for executables? Yuck! Letter
case adds to the confusion here).
man xsession
Xsession(5)
NAME
Xsession - initialize X session
N.B:- Tested in ubuntu 8.04.1
chown
Setting File Ownership with chown
Problem
You need to change ownership on a file or directory. Perhaps you've copied something to someone else's directory but she still can't edit it, because it's owned by you. Many Linux problems result from incorrect ownership or permission. You're seeing messages like "Permission denied" or "File is read-only" when it shouldn't be.
Solution
Use chown (change owner) to change the file owner, the file and group owner, or the group owner:
# chown user filename
# chown user:group filename
# chown :group filename
For example:
$ chown -v carlas:share index.txt
changed ownership of `index.txt' to carlas:share
$ chown -v :share toc.txt
changed ownership of `toc.txt' to :share
Problem
You want to change ownership of directories and their contents, or just the contents of directories, a list of files, or change ownership of files from one UID to another.
Solution
chown supports some batch operations, or you can use find, or you can use shell wildcards.
you can use shell wildcards:
# chown carlas *.txt
To give all of a user's files to another user, use:
# chown -R -v from valh piglet /shared/scripts
You can do the same thing with find:
# find / -user valh -exec chown -v piglet { } \;
find can also search by UID, which chown cannot:
# find / -uid 1050 -exec chown -v 1200 { } \;
To change the ownership of a directory, including subdirectories and files, with verbose output, use:
# chown -R -v piglet /shared/scripts
changed ownership of `scripts' to piglet
changed ownership of `scripts/backups.tgz' to piglet
changed ownership of `scripts/fake-spec-rpm' to piglet
Either the user's login name or UID can be used. If you've deleted a user and the user has left behind orphan files, you'll need the UID.
Problem
You need to change ownership on a file or directory. Perhaps you've copied something to someone else's directory but she still can't edit it, because it's owned by you. Many Linux problems result from incorrect ownership or permission. You're seeing messages like "Permission denied" or "File is read-only" when it shouldn't be.
Solution
Use chown (change owner) to change the file owner, the file and group owner, or the group owner:
# chown user filename
# chown user:group filename
# chown :group filename
For example:
$ chown -v carlas:share index.txt
changed ownership of `index.txt' to carlas:share
$ chown -v :share toc.txt
changed ownership of `toc.txt' to :share
Problem
You want to change ownership of directories and their contents, or just the contents of directories, a list of files, or change ownership of files from one UID to another.
Solution
chown supports some batch operations, or you can use find, or you can use shell wildcards.
you can use shell wildcards:
# chown carlas *.txt
To give all of a user's files to another user, use:
# chown -R -v from valh piglet /shared/scripts
You can do the same thing with find:
# find / -user valh -exec chown -v piglet { } \;
find can also search by UID, which chown cannot:
# find / -uid 1050 -exec chown -v 1200 { } \;
To change the ownership of a directory, including subdirectories and files, with verbose output, use:
# chown -R -v piglet /shared/scripts
changed ownership of `scripts' to piglet
changed ownership of `scripts/backups.tgz' to piglet
changed ownership of `scripts/fake-spec-rpm' to piglet
Either the user's login name or UID can be used. If you've deleted a user and the user has left behind orphan files, you'll need the UID.
chmod
Use the setgid bit to automatically set the shared group ownership on files.
This is how to set it with octal notation: chmod -v 2775 /shared-directory
You can also use symbolic notation: chmod -v +s /shared-directory
Keep in mind that +s sets both the setgid and setuid bits, which could be a security problem if executables or scripts are stored in this directory. chmod 2775 sets only the setgid bit.
Add the sticky bit to prevent anyone but the file owner from deleting the file, by using:
# chmod +t /shared-directory or chmod 3775 /shared-directory
On a historical note , UNIX systems used to use the sticky bit on files to hoard executable files in swap space and avoid reloading.
Setting File and Directory Permissions with chmod's Symbolic Notation
You would like to change specific permission bits, rather than using the all-or-nothing approach of chmod's numeric notation, such as marking a script as executable.
Solution
The most common use for symbolic notation is to add the executable bit to a file's permissions without changing any other permissions:
$ chmod +x scriptname
The default action is a, or all, so the example makes scriptname executable by everyone. This adds the executable bit to the file owner only:
$ chmod u+x scriptname
You can surgically remove a specific mode bit. In this example, the group and other users lose their executable bits:
$ chmod go-x scriptname
This is a quick way to set the setgid bit on a directory, for creating a shared directory. All files created in this directory will have the same group ownership as the directory:
$ chmod +s /shared-directory
You can remove all permissions for group and other users by doing the following:
$ chmod go= scriptname
To make group permissions the same as the file owner's, use:
$ chmod g=u scriptname
Doing Batch Operations with chmod
Problem You need to set permissions on all the files or a directory, or on batches of files.
Solution
chmod supports operating on lists of files. You can also use find or shell wildcards to generate a list.
To make several files read-only for everyone, you can use chmod as follows:
$ chmod 444 file.txt file2.txt file3.txt
To make all files in the current directory readable/writable, for the file owner and group, without changing the directory permissions, use:
$ find . -type f -exec chmod -v 660 { } \;
You can also change all files belonging to a particular user. This example starts at the root of the filesystem:
$ find / -user terri -exec chmod -v 660 { } \;
You can set permissions for a directory and its contents, including subdirectories, with the -R (recursive) flag:
$ chmod -R -v 755 /shared
This example makes all the .txt files in the current directory readable/writable to the owner, and world-readable:
$ chmod -v 644 *.txt
To change all files in the current directory that begin with your chosen string, use:
$ chmod -v 644 apt*
access mode symbolic octal
suid s with u 4000
sgid s with g 2000
sticky t 1000
immutable files
ex: touch keep.txt
chattr +i keep.txt
only root user can create an immutable file but cannot delete it until the flag is removed.
making files immutable is often done as a part of security or intrusion detection effort
This is how to set it with octal notation: chmod -v 2775 /shared-directory
You can also use symbolic notation: chmod -v +s /shared-directory
Keep in mind that +s sets both the setgid and setuid bits, which could be a security problem if executables or scripts are stored in this directory. chmod 2775 sets only the setgid bit.
Add the sticky bit to prevent anyone but the file owner from deleting the file, by using:
# chmod +t /shared-directory or chmod 3775 /shared-directory
On a historical note , UNIX systems used to use the sticky bit on files to hoard executable files in swap space and avoid reloading.
Setting File and Directory Permissions with chmod's Symbolic Notation
You would like to change specific permission bits, rather than using the all-or-nothing approach of chmod's numeric notation, such as marking a script as executable.
Solution
The most common use for symbolic notation is to add the executable bit to a file's permissions without changing any other permissions:
$ chmod +x scriptname
The default action is a, or all, so the example makes scriptname executable by everyone. This adds the executable bit to the file owner only:
$ chmod u+x scriptname
You can surgically remove a specific mode bit. In this example, the group and other users lose their executable bits:
$ chmod go-x scriptname
This is a quick way to set the setgid bit on a directory, for creating a shared directory. All files created in this directory will have the same group ownership as the directory:
$ chmod +s /shared-directory
You can remove all permissions for group and other users by doing the following:
$ chmod go= scriptname
To make group permissions the same as the file owner's, use:
$ chmod g=u scriptname
Doing Batch Operations with chmod
Problem You need to set permissions on all the files or a directory, or on batches of files.
Solution
chmod supports operating on lists of files. You can also use find or shell wildcards to generate a list.
To make several files read-only for everyone, you can use chmod as follows:
$ chmod 444 file.txt file2.txt file3.txt
To make all files in the current directory readable/writable, for the file owner and group, without changing the directory permissions, use:
$ find . -type f -exec chmod -v 660 { } \;
You can also change all files belonging to a particular user. This example starts at the root of the filesystem:
$ find / -user terri -exec chmod -v 660 { } \;
You can set permissions for a directory and its contents, including subdirectories, with the -R (recursive) flag:
$ chmod -R -v 755 /shared
This example makes all the .txt files in the current directory readable/writable to the owner, and world-readable:
$ chmod -v 644 *.txt
To change all files in the current directory that begin with your chosen string, use:
$ chmod -v 644 apt*
access mode symbolic octal
suid s with u 4000
sgid s with g 2000
sticky t 1000
immutable files
ex: touch keep.txt
chattr +i keep.txt
only root user can create an immutable file but cannot delete it until the flag is removed.
making files immutable is often done as a part of security or intrusion detection effort
Configuring Filesystem Mounts with /etc/fstab
Problem
Users need to make their own backups on CDs, and use USB memory sticks and other types of removable media. You don't want to give them root privileges just so they can mount these devices. But only root can use the mount command we discussed in Recipe 9.9. And you also want to control which file systems are automatically mounted at boot.
Solution
Add entries to /etc/fstab, defining mount points and access permissions.
This example shows a Linux partition, two Windows partitions, and removable media:
#
/dev/hda6 /rh-data reiserfs defaults,user,noauto 0 1
/dev/hda1 /win2k ntfs defaults,user,ro,gid=win2k 0 0
/dev/hda2 /win98 vfat defaults,user,gid=win98 0 0
/dev/hdc0 /cdrom auto defaults,user,noauto,ro 0 0
/dev/fd0 /floppy auto defaults,user,noauto 0 0
/dev/sda1 /memstick auto defaults,user,noauto 0 0
Once a device has an entry in /etc/fstab, it can be mounted by using the mountpoint:
$ mount /cdrom
$ mount /memstick
And unmounted the same way: $ umount /cdrom
Discussion
These are the six fields that make up /etc/fstab:
device The device name assigned by the kernel.
mountpoint The directory to which the filesystem is attached, which is user-defined.
type The filesystem type. It's okay to use "auto" in this field for most filesystems. See mount(8) for the supported filesystem types.
options Command options in a comma-delimited list. See mount(8) for a complete list
dump
If you're using the dump command for backups, this tells dump the backup interval, in days. 1 means every day, 2 means every other day, and so on.
pass This tells fsck which filesystem to check first at boot up, if it ever needs to. Make your root filesystem 1, any other Linux filesystems 2, and non-Linux filesystems 0.
Let's take a closer look at what goes in the options field. All these values belong to the defaults option:
rw Read/write.
suid Allow setuid and setgid bits to operate.
dev Interpret block and character devices.
exec Allow execution of binaries.
auto
This is used in boot scripts (Debian uses /etc/init.d/mountall.sh; Red Hat uses /etc/rc.d/rc.sysinit), indicating which filesystems are to be started at boot up.
nouser Non-root users cannot mount or unmount the filesystem.
async Asynchronous I/O, which is standard for Linux.
The defaults values are overridden by appending additional options, as on the win2k line in the /etc/fstab example above (defaults,user,ro,gid=win2k). The options are:
user
Non-root users can mount and unmount the device, provided they were the ones who mounted it
users
Any user can unmount the device.
noauto
The device must be explicitly mounted by a user and does not automatically mount at boot.
ro
The device is read-only. Be sure to use this for NTFS volumes.
noatime
Do not update the "time accessed" file attribute. This speeds up filesystem performance. It also extends the life of CD-RWs and DVD-RWs that use packet-writing, and of USB storage media, by reducing the number of writes.
gid=win2k
Assign group membership, if you are controlling access with groups.
Mounting filesystems, not devices
We tend to think of mounting devices and partitions, but strictly speaking, only filesystems are mounted. "Mount" and "attach" mean the same thing, if you want a different word to use. Some Linux distributions, such as Red Hat, use the /mnt directory. Debian uses top-level directories, such as /floppy or /cdrom. There's no hard-and-fast rule; put them wherever it suits you. Just be careful not to mount two filesystems in the same directory. If you do, the existing files will disappear until the intruder filesystem is unmounted.
Usually it's not necessary to specify the filesystem type, because mount will figure it out. First, it will probe the superblock. Currently adfs, bfs, cramfs, ext, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, ntfs, qnx4, reiserfs, romfs, udf, ufs, vxfs, xfs, and xiafs are supported. If that fails, it will try each filesystem listed in /proc/filesystems, which shows all the filesystems supported by your kernel.
source Carla Schroder
Users need to make their own backups on CDs, and use USB memory sticks and other types of removable media. You don't want to give them root privileges just so they can mount these devices. But only root can use the mount command we discussed in Recipe 9.9. And you also want to control which file systems are automatically mounted at boot.
Solution
Add entries to /etc/fstab, defining mount points and access permissions.
This example shows a Linux partition, two Windows partitions, and removable media:
#
/dev/hda6 /rh-data reiserfs defaults,user,noauto 0 1
/dev/hda1 /win2k ntfs defaults,user,ro,gid=win2k 0 0
/dev/hda2 /win98 vfat defaults,user,gid=win98 0 0
/dev/hdc0 /cdrom auto defaults,user,noauto,ro 0 0
/dev/fd0 /floppy auto defaults,user,noauto 0 0
/dev/sda1 /memstick auto defaults,user,noauto 0 0
Once a device has an entry in /etc/fstab, it can be mounted by using the mountpoint:
$ mount /cdrom
$ mount /memstick
And unmounted the same way: $ umount /cdrom
Discussion
These are the six fields that make up /etc/fstab:
device The device name assigned by the kernel.
mountpoint The directory to which the filesystem is attached, which is user-defined.
type The filesystem type. It's okay to use "auto" in this field for most filesystems. See mount(8) for the supported filesystem types.
options Command options in a comma-delimited list. See mount(8) for a complete list
dump
If you're using the dump command for backups, this tells dump the backup interval, in days. 1 means every day, 2 means every other day, and so on.
pass This tells fsck which filesystem to check first at boot up, if it ever needs to. Make your root filesystem 1, any other Linux filesystems 2, and non-Linux filesystems 0.
Let's take a closer look at what goes in the options field. All these values belong to the defaults option:
rw Read/write.
suid Allow setuid and setgid bits to operate.
dev Interpret block and character devices.
exec Allow execution of binaries.
auto
This is used in boot scripts (Debian uses /etc/init.d/mountall.sh; Red Hat uses /etc/rc.d/rc.sysinit), indicating which filesystems are to be started at boot up.
nouser Non-root users cannot mount or unmount the filesystem.
async Asynchronous I/O, which is standard for Linux.
The defaults values are overridden by appending additional options, as on the win2k line in the /etc/fstab example above (defaults,user,ro,gid=win2k). The options are:
user
Non-root users can mount and unmount the device, provided they were the ones who mounted it
users
Any user can unmount the device.
noauto
The device must be explicitly mounted by a user and does not automatically mount at boot.
ro
The device is read-only. Be sure to use this for NTFS volumes.
noatime
Do not update the "time accessed" file attribute. This speeds up filesystem performance. It also extends the life of CD-RWs and DVD-RWs that use packet-writing, and of USB storage media, by reducing the number of writes.
gid=win2k
Assign group membership, if you are controlling access with groups.
Mounting filesystems, not devices
We tend to think of mounting devices and partitions, but strictly speaking, only filesystems are mounted. "Mount" and "attach" mean the same thing, if you want a different word to use. Some Linux distributions, such as Red Hat, use the /mnt directory. Debian uses top-level directories, such as /floppy or /cdrom. There's no hard-and-fast rule; put them wherever it suits you. Just be careful not to mount two filesystems in the same directory. If you do, the existing files will disappear until the intruder filesystem is unmounted.
Usually it's not necessary to specify the filesystem type, because mount will figure it out. First, it will probe the superblock. Currently adfs, bfs, cramfs, ext, ext2, ext3, hfs, hpfs, iso9660, jfs, minix, ntfs, qnx4, reiserfs, romfs, udf, ufs, vxfs, xfs, and xiafs are supported. If that fails, it will try each filesystem listed in /proc/filesystems, which shows all the filesystems supported by your kernel.
source Carla Schroder
Wednesday, November 26, 2008
Detecting Hardware with lspci
Problem
You're looking at new systems, or installing Linux on a box that used to run a different OS, and you're wondering if all the componentsvideo, modem, Ethernet, sound will work on Linux. The vendors can't, or won't, tell you if their products will work on Linux. You need to know what the chipsets are, to find out if there are Linux drivers.
Alternatively, you want to know what components are installed inside a computer, and you don't feel like hauling the thing out, popping the case open, and tearing it apart.
Solution
Use lspci:
# /sbin/lscpi
# /sbin/lspci -v
# /sbin/lspci -vv
To show a summary of all devices connected to the PCI bus, use:
$ /sbin/lspci
00:00.0 Host bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133] (rev 02)
00:01.0 PCI bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133 AGP]
00:06.0 Ethernet controller: Linksys Network Everywhere Fast Ethernet 10/100 model NC100
(rev 11)
...
Use the -v or -vv flags to display more information:
# /sbin/lspci -v
0000:01:00.0 VGA compatible controller: 3Dfx Interactive, Inc. Voodoo 3 (rev 01) (prog-if
00 [VGA])
Subsystem: 3Dfx Interactive, Inc.: Unknown device 1252
Flags: 66MHz, fast devsel, IRQ 10
Memory at d4000000 (32-bit, non-prefetchable) [size=32M]
Memory at d8000000 (32-bit, prefetchable) [size=32M]
I/O ports at c000 [size=256]
Expansion ROM at [disabled] [size=64K]
Capabilities: [54] AGP version 1.0
Capabilities: [60] Power Management version 1
If you're looking for drivers, you can now take this output (e.g., VT8363/8365 or 3Dfx Interactive, Inc. Voodoo 3 (rev 01)) to run a Google search.
5.2.3 Discussion
lspci reads some information from the PCI bus, then displays additional information from its own database of hardware IDsvendors, devices, classes and subclasses at /usr/share/misc/pci.ids. There is even a command to update this file:
# update-pciids
The lspci maintainers welcome submissions of new data; please read /usr/share/misc/pci.ids for how to make submissions.If there is a device attached to the system that the lspci simply does not recognize, such as a very old, odd ISA device, you'll have to open the case to see what it is. Or try running dmesg
source:- carla schroder
You're looking at new systems, or installing Linux on a box that used to run a different OS, and you're wondering if all the componentsvideo, modem, Ethernet, sound will work on Linux. The vendors can't, or won't, tell you if their products will work on Linux. You need to know what the chipsets are, to find out if there are Linux drivers.
Alternatively, you want to know what components are installed inside a computer, and you don't feel like hauling the thing out, popping the case open, and tearing it apart.
Solution
Use lspci:
# /sbin/lscpi
# /sbin/lspci -v
# /sbin/lspci -vv
To show a summary of all devices connected to the PCI bus, use:
$ /sbin/lspci
00:00.0 Host bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133] (rev 02)
00:01.0 PCI bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133 AGP]
00:06.0 Ethernet controller: Linksys Network Everywhere Fast Ethernet 10/100 model NC100
(rev 11)
...
Use the -v or -vv flags to display more information:
# /sbin/lspci -v
0000:01:00.0 VGA compatible controller: 3Dfx Interactive, Inc. Voodoo 3 (rev 01) (prog-if
00 [VGA])
Subsystem: 3Dfx Interactive, Inc.: Unknown device 1252
Flags: 66MHz, fast devsel, IRQ 10
Memory at d4000000 (32-bit, non-prefetchable) [size=32M]
Memory at d8000000 (32-bit, prefetchable) [size=32M]
I/O ports at c000 [size=256]
Expansion ROM at
Capabilities: [54] AGP version 1.0
Capabilities: [60] Power Management version 1
If you're looking for drivers, you can now take this output (e.g., VT8363/8365 or 3Dfx Interactive, Inc. Voodoo 3 (rev 01)) to run a Google search.
5.2.3 Discussion
lspci reads some information from the PCI bus, then displays additional information from its own database of hardware IDsvendors, devices, classes and subclasses at /usr/share/misc/pci.ids. There is even a command to update this file:
# update-pciids
The lspci maintainers welcome submissions of new data; please read /usr/share/misc/pci.ids for how to make submissions.If there is a device attached to the system that the lspci simply does not recognize, such as a very old, odd ISA device, you'll have to open the case to see what it is. Or try running dmesg
source:- carla schroder
Sunday, November 23, 2008
Examining Local Network Activities
You want to examine network use occurring on your local machine.
Solution
To print a summary of network use:
$ netstat --inet Connected sockets
$ netstat --inet --listening Server sockets
$ netstat --inet --all Both
# netstat --inet ... -p Identify processes
To print dynamically assigned ports for RPC services:
$ rpcinfo -p [host]
To list network connections for all processes:
# lsof -i[TCP|UDP][@host][:port]
To list all open files for specific processes:
# lsof -p pid
# lsof -c command
# lsof -u username
source:- Robert g byrnes
netstat -s --- this will display network statistics report
Displaying all active Internet connections in Linux.
Answer:
It may be necessary to display what Internet connections are active on your Linux box. For example, seeing if the Apache service is actively running and if running what network ports it's listening to. To do this run the below netstat command in the command line.
netstat -natp
Using the netstat Command
To track what ports are open and what ports have processes listening to them, we use the netstat command. For example:
[root@serverA ~]# netstat -natu
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:32768 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5335 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 132 192.168.1.4:22 192.168.1.33:2129 ESTABLISHED
udp 0 0 0.0.0.0:32768 0.0.0.0:*
tcp 0 0 ::ffff:192.168.1.4:22 ::ffff:192.168.1.90:40587 ESTABLISHED
udp 0 0 0.0.0.0:631 0.0.0.0:*
By default (with no parameters), netstat will provide all established connections for both network and domain sockets. That means we’ll see not only the connections that are actually working over the network, but also the interprocess communications (which, from a security monitoring standpoint, are not useful). So in the command just illustrated, we have asked netstat to show us all ports (-a)—whether they are listening or actually connected—for TCP (-t) and UDP (-u). We have told netstat not to spend any time resolving IP addresses to hostnames (-n).
In the netstat output, each line represents either a TCP or UDP network port, as indicated by the first column of the output. The Recv-Q (receive queue) column lists the number of bytes received by the kernel but not read by the process. Next, the Send-Q (send queue) column tells us the number of bytes sent to the other side of the connection but not acknowledged.
The fourth, fifth, and sixth columns are the most interesting in terms of system security. The Local Address column tells you your server’s IP address and port number.Remember that your server recognizes itself as 127.0.0.1 and 0.0.0.0, as well as its normal IP address. In the case of multiple interfaces, each port being listened to will show up on all interfaces and, thus, as separate IP addresses. The port number is separated from the IP address by a colon. In the output from the netstat example just shown, the Ethernet device has the IP address 192.168.1.4.
The fifth column, Foreign Address, identifies the other side of the connection. In the case of a port that is being listened to for new connections, the default value will be 0.0.0.0:*. This IP address means nothing, since we’re still waiting for a remote host to connect to us!
The sixth column tells us the state of the connection. The man page for netstat lists all of the states, but the two you’ll see most often are LISTEN and ESTABLISHED. The LISTEN state means there is a process on your server listening to the port and ready to accept new connections. The ESTABLISHED state means just that—a connection is established between a client and server.
Solution
To print a summary of network use:
$ netstat --inet Connected sockets
$ netstat --inet --listening Server sockets
$ netstat --inet --all Both
# netstat --inet ... -p Identify processes
To print dynamically assigned ports for RPC services:
$ rpcinfo -p [host]
To list network connections for all processes:
# lsof -i[TCP|UDP][@host][:port]
To list all open files for specific processes:
# lsof -p pid
# lsof -c command
# lsof -u username
source:- Robert g byrnes
netstat -s --- this will display network statistics report
Displaying all active Internet connections in Linux.
Answer:
It may be necessary to display what Internet connections are active on your Linux box. For example, seeing if the Apache service is actively running and if running what network ports it's listening to. To do this run the below netstat command in the command line.
netstat -natp
Using the netstat Command
To track what ports are open and what ports have processes listening to them, we use the netstat command. For example:
[root@serverA ~]# netstat -natu
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:32768 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:113 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5335 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 132 192.168.1.4:22 192.168.1.33:2129 ESTABLISHED
udp 0 0 0.0.0.0:32768 0.0.0.0:*
tcp 0 0 ::ffff:192.168.1.4:22 ::ffff:192.168.1.90:40587 ESTABLISHED
udp 0 0 0.0.0.0:631 0.0.0.0:*
By default (with no parameters), netstat will provide all established connections for both network and domain sockets. That means we’ll see not only the connections that are actually working over the network, but also the interprocess communications (which, from a security monitoring standpoint, are not useful). So in the command just illustrated, we have asked netstat to show us all ports (-a)—whether they are listening or actually connected—for TCP (-t) and UDP (-u). We have told netstat not to spend any time resolving IP addresses to hostnames (-n).
In the netstat output, each line represents either a TCP or UDP network port, as indicated by the first column of the output. The Recv-Q (receive queue) column lists the number of bytes received by the kernel but not read by the process. Next, the Send-Q (send queue) column tells us the number of bytes sent to the other side of the connection but not acknowledged.
The fourth, fifth, and sixth columns are the most interesting in terms of system security. The Local Address column tells you your server’s IP address and port number.Remember that your server recognizes itself as 127.0.0.1 and 0.0.0.0, as well as its normal IP address. In the case of multiple interfaces, each port being listened to will show up on all interfaces and, thus, as separate IP addresses. The port number is separated from the IP address by a colon. In the output from the netstat example just shown, the Ethernet device has the IP address 192.168.1.4.
The fifth column, Foreign Address, identifies the other side of the connection. In the case of a port that is being listened to for new connections, the default value will be 0.0.0.0:*. This IP address means nothing, since we’re still waiting for a remote host to connect to us!
The sixth column tells us the state of the connection. The man page for netstat lists all of the states, but the two you’ll see most often are LISTEN and ESTABLISHED. The LISTEN state means there is a process on your server listening to the port and ready to accept new connections. The ESTABLISHED state means just that—a connection is established between a client and server.
Symmetric key encryption and decryption using gpg
You want to encrypt a file so only you can decrypt it with a password.
Solution
$ gpg -c filename
Symmetric encryption (-c) is the simplest way to encrypt a file with gpg: just provide a password at encryption time. To decrypt, provide the password again.
By default, encrypted files are binary. To produce an ASCII text file instead, add the -a (armor) option: $ gpg -c -a filename
Binary encrypted files are created with the suffix .gpg, whereas ASCII encrypted files have the suffix .asc.
You want to decrypt a file that was encrypted with GnuPG.
Solution
Assuming the file is myfile.gpg, decrypt it in place with:
$ gpg myfile.gpg creates myfile
Decrypt to standard output:
$ gpg --decrypt myfile.gpg
Decrypt to a named plaintext file:
$ gpg --decrypt --output new_file_name myfile.gpg
source Richard E silvermann
Solution
$ gpg -c filename
Symmetric encryption (-c) is the simplest way to encrypt a file with gpg: just provide a password at encryption time. To decrypt, provide the password again.
By default, encrypted files are binary. To produce an ASCII text file instead, add the -a (armor) option: $ gpg -c -a filename
Binary encrypted files are created with the suffix .gpg, whereas ASCII encrypted files have the suffix .asc.
You want to decrypt a file that was encrypted with GnuPG.
Solution
Assuming the file is myfile.gpg, decrypt it in place with:
$ gpg myfile.gpg creates myfile
Decrypt to standard output:
$ gpg --decrypt myfile.gpg
Decrypt to a named plaintext file:
$ gpg --decrypt --output new_file_name myfile.gpg
source Richard E silvermann
Prohibiting Directory Listings
You want to prohibit directory listings for a particular directory, yet still permit the files within to be accessed by name.
Solution
Use a directory that has read permission disabled, but execute permission enabled:
$ mkdir dir
$ chmod 0111 dir
$ ls -ld dir
d--x--x--x 2 smith smith 4096 Apr 2 22:04 dir/
$ ls dir
/bin/ls: dir: Permission denied
$ echo hello world > dir/secretfile
$ cd dir
$ cat secretfile
hello world
More practically, to permit only yourself to list a directory owned by you:
$ chmod 0711 dir
$ ls -ld dir
drwx--x--x 2 smith smith 4096 Apr 2 22:04 dir/
A Directory's read permission controls whether it can be listed (eg:- via ls), and the execute permission controls whether it can be entered (eg:- via c.d). Of course the super user can still access your directory anyway he/she likes
This technique is useful for websites, where listing of directories are not permitted
source Danile J Barret
Solution
Use a directory that has read permission disabled, but execute permission enabled:
$ mkdir dir
$ chmod 0111 dir
$ ls -ld dir
d--x--x--x 2 smith smith 4096 Apr 2 22:04 dir/
$ ls dir
/bin/ls: dir: Permission denied
$ echo hello world > dir/secretfile
$ cd dir
$ cat secretfile
hello world
More practically, to permit only yourself to list a directory owned by you:
$ chmod 0711 dir
$ ls -ld dir
drwx--x--x 2 smith smith 4096 Apr 2 22:04 dir/
A Directory's read permission controls whether it can be listed (eg:- via ls), and the execute permission controls whether it can be entered (eg:- via c.d). Of course the super user can still access your directory anyway he/she likes
This technique is useful for websites, where listing of directories are not permitted
source Danile J Barret
Invoking Remote Programs
You want to invoke a program on a remote machine over a secure network connection
For non interactive commands
ssh -l remoteuser remotehost uptime
for interactive programs, add the -t option
ssh -t -l remoteuser remotehost vi
For X window applications, add the -X option to enable X forwarding.also add the -f option to background the program after authentication , and to redirect standard input fro /dev/null to avoid dangling connections.
ssh -X -f -l remoteuser remotehost xterm
or you can add the -C option to enable compression:-
ssh -C -X user@hostname gui_cmd
verified on ubuntu 8.04.1
For non interactive commands
ssh -l remoteuser remotehost uptime
for interactive programs, add the -t option
ssh -t -l remoteuser remotehost vi
For X window applications, add the -X option to enable X forwarding.also add the -f option to background the program after authentication , and to redirect standard input fro /dev/null to avoid dangling connections.
ssh -X -f -l remoteuser remotehost xterm
or you can add the -C option to enable compression:-
ssh -C -X user@hostname gui_cmd
verified on ubuntu 8.04.1
Thursday, November 20, 2008
IrDA & ubuntu
Can anyone give me an example/practical situation where IrDA protocol is being used in Ubuntu Linux ?
Thane
Afraid I don't know of any offhand. But some sports heartrate monitors can use irda to transfer data (in the evil empire win-Doh system which is unfortunately ahead of us in this respect). Polar hrm's for instance of which there are a couple in our household, use irda in some models along with other methods. The problem I found, even in the evil empire case is that depending on your motherboard, you may or may not be able to use irda for your particular application, irrespective of which OS you're using. I have 3 computers in the house plus a laptop and unfortunately only the laptop can use my irda for my Polar hrm due to the Asus mobo's in the other 3 computers. One of the few shortcomings I've found with Asus mobo's. As I seem to recall it was a problem of the brand of usb controller used in the mobo. I spent some time emailing back and forth with Polar tech support in Europe, where they have different irda adapters, and they went out of their way (for which I'm really grateful) to unexpectedly send me an irda unit used in Britain for free as a goodwill gesture and although both Polar and I thought it was going to solve my problem, the mobo components jumped in to spoil the day. Don't know what you're planning on coming up with for irda, but this one problem might be something to consider. Cheers.
Thane
Afraid I don't know of any offhand. But some sports heartrate monitors can use irda to transfer data (in the evil empire win-Doh system which is unfortunately ahead of us in this respect). Polar hrm's for instance of which there are a couple in our household, use irda in some models along with other methods. The problem I found, even in the evil empire case is that depending on your motherboard, you may or may not be able to use irda for your particular application, irrespective of which OS you're using. I have 3 computers in the house plus a laptop and unfortunately only the laptop can use my irda for my Polar hrm due to the Asus mobo's in the other 3 computers. One of the few shortcomings I've found with Asus mobo's. As I seem to recall it was a problem of the brand of usb controller used in the mobo. I spent some time emailing back and forth with Polar tech support in Europe, where they have different irda adapters, and they went out of their way (for which I'm really grateful) to unexpectedly send me an irda unit used in Britain for free as a goodwill gesture and although both Polar and I thought it was going to solve my problem, the mobo components jumped in to spoil the day. Don't know what you're planning on coming up with for irda, but this one problem might be something to consider. Cheers.
Tuesday, November 18, 2008
Offline updation in ubuntu
bobbertface
I have a desktop with Hardy installed, and I want to update and upgrade it, however, it doesn't have a wired connection, and the wireless card is not supported by the kernel. I tried installing ndiswrapper to fix this problem because my Dell Wireless 1505 Draft 802.11n WLAN Mini-Card Rev 2.0 is supported by it. The fun part is, I need the c/c++ developer files to compile and install ndiswrapper.
What would be a good way to get those libraries over to the offline computer, or would using an already compiled ndiswrapper binary work fine? (if so, any recommendations as to which one works best?)
Thanks for any help you can provide
dstew
You only need to compile ndiswrapper if the most recent Ubuntu packaged verion is not adequate.
To update or install programs off-line, you need to be aware that there are lots of dependencies to be satisfied for installations to work. You can't usually download the package you want and install it, because it will complain that it needs all these dependent packages to be installed first.
There is a service called nonetdebs that attempts to solve this problem. You create a text file of the status of your off-line system, copy it over to an on-line system, and upload it to nonetdebs. The service prepares a bunch of links to all the packages you need to install in order to update, or install a particular package. You copy the packages onto a disk or USB stick, and copy them onto your off-line system, and install them using dpkg.
Try updating first, and see if you get a newer driver that might make your wireless card operational. If that doesn't work, try the ndisgtk program. I think it might be part of Ubuntu already, or you can install it. It is a graphical front-end for ndiswrapper that lets you navigate to where the Windows driver files are, and install them. To run it, hit alt-F2 and enter
Code:
gksudo ndisgtk
khAttam
Why don't you try out:
http://offlineubuntu.awardspace.com/
It has step by step procedure to help you update and install packages to your offline ubuntu installation...
I have a desktop with Hardy installed, and I want to update and upgrade it, however, it doesn't have a wired connection, and the wireless card is not supported by the kernel. I tried installing ndiswrapper to fix this problem because my Dell Wireless 1505 Draft 802.11n WLAN Mini-Card Rev 2.0 is supported by it. The fun part is, I need the c/c++ developer files to compile and install ndiswrapper.
What would be a good way to get those libraries over to the offline computer, or would using an already compiled ndiswrapper binary work fine? (if so, any recommendations as to which one works best?)
Thanks for any help you can provide
dstew
You only need to compile ndiswrapper if the most recent Ubuntu packaged verion is not adequate.
To update or install programs off-line, you need to be aware that there are lots of dependencies to be satisfied for installations to work. You can't usually download the package you want and install it, because it will complain that it needs all these dependent packages to be installed first.
There is a service called nonetdebs that attempts to solve this problem. You create a text file of the status of your off-line system, copy it over to an on-line system, and upload it to nonetdebs. The service prepares a bunch of links to all the packages you need to install in order to update, or install a particular package. You copy the packages onto a disk or USB stick, and copy them onto your off-line system, and install them using dpkg.
Try updating first, and see if you get a newer driver that might make your wireless card operational. If that doesn't work, try the ndisgtk program. I think it might be part of Ubuntu already, or you can install it. It is a graphical front-end for ndiswrapper that lets you navigate to where the Windows driver files are, and install them. To run it, hit alt-F2 and enter
Code:
gksudo ndisgtk
khAttam
Why don't you try out:
http://offlineubuntu.awardspace.com/
It has step by step procedure to help you update and install packages to your offline ubuntu installation...
Monday, November 17, 2008
Free software and Open source software
sulekha
I am new to linux. Can anyone explain me the difference between Free software and Open source software ?
ray
In a nutshell, Open Source software must have the source code available -"free" software, i.e. "freeware" does not - the creator might distribute only the executables. Most Open Source software is distributed under one or another license which places some restrictions on reuse.
Peter Kohlmann
Thats not at all the description.
"Free software" means just that, you can't take away the freedoms of it. It usually comes with a GPL licence. You can't make it closed source
"Freeware" is something entirely different, and it is mainly a windows thing.
> Most Open Source software is distributed under one or another license which places some restrictions on reuse.
OSS does not /need/ to use the GPL or compatible licence. It can also use the BSD licence. It is still Open Source then, but under that licence anyone can pick it up, add his own code to it and market it under a non-free, closed source licence
I am new to linux. Can anyone explain me the difference between Free software and Open source software ?
ray
In a nutshell, Open Source software must have the source code available -"free" software, i.e. "freeware" does not - the creator might distribute only the executables. Most Open Source software is distributed under one or another license which places some restrictions on reuse.
Peter Kohlmann
Thats not at all the description.
"Free software" means just that, you can't take away the freedoms of it. It usually comes with a GPL licence. You can't make it closed source
"Freeware" is something entirely different, and it is mainly a windows thing.
> Most Open Source software is distributed under one or another license which places some restrictions on reuse.
OSS does not /need/ to use the GPL or compatible licence. It can also use the BSD licence. It is still Open Source then, but under that licence anyone can pick it up, add his own code to it and market it under a non-free, closed source licence
Current FSB speed
annalissa
I use pentium(R)Dual core processor E2180, with Freq 2Ghz, Core 1.35V, FSB 800 Mhz, Socket LGA775 and L2 cache 1MB now the motherboard i use in my PC is ASUS P5KPL-CM, which in its specification says that its FSB is 1600 Mhz. now my question is what exactly FSB speed that is used in my PC, what is the command in linux to get FSB speed
NB: I use ubuntu linux 8.04.1.
1PW
A chain is as weak as its weakest link; 800 MHz. Try dmidecode.
annalissa
when i gave the command in my computer in Office
sudo dmidecode --type processor 4
I got the output as
# dmidecode 2.9
SMBIOS 2.3 present.
Handle 0x0004, DMI type 4, 35 bytes
Processor Information
Socket Designation: Socket 775
Type: Central Processor
Family: Pentium D
Manufacturer: Intel
ID: FD 06 00 00 FF FB EB BF
Signature: Type 0, Family 6, Model 15, Stepping 13
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (Fast floating-point save and restore)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Hyper-threading technology)
TM (Thermal monitor supported)
PBE (Pending break enabled)
Version: Intel(R) Pentium(R) Dual
Voltage: 0.0 V
External Clock: 200 MHz
Max Speed: 4000 MHz
Current Speed: 2000 MHz
Status: Populated, Enabled
Upgrade: Other
L1 Cache Handle: 0x0008
L2 Cache Handle: 0x0009
L3 Cache Handle: Not Provided
Serial Number:
Asset Tag:
Part Number:
I didn't see any entry for FSB,
1PW
dmidecode allows you to "read" a system and derive the motherboard & CPU information without having to open the enclosure. From there, you can consult the specifications from the web sites of the manufacturers.
In your case, you already had the data at hand. I don't know of any performance tests that will directly measure a system's FSB speed.
Anton Ertl
> sudo dmidecode --type processor 4
...
> External Clock: 200 MHz
...
>I didn't see any entry for FSB,
It's the external clock. The FSB is quad data rate (QDR), so a 200MHz QDR FSB is usually called FSB800.
I use pentium(R)Dual core processor E2180, with Freq 2Ghz, Core 1.35V, FSB 800 Mhz, Socket LGA775 and L2 cache 1MB now the motherboard i use in my PC is ASUS P5KPL-CM, which in its specification says that its FSB is 1600 Mhz. now my question is what exactly FSB speed that is used in my PC, what is the command in linux to get FSB speed
NB: I use ubuntu linux 8.04.1.
1PW
A chain is as weak as its weakest link; 800 MHz. Try dmidecode.
annalissa
when i gave the command in my computer in Office
sudo dmidecode --type processor 4
I got the output as
# dmidecode 2.9
SMBIOS 2.3 present.
Handle 0x0004, DMI type 4, 35 bytes
Processor Information
Socket Designation: Socket 775
Type: Central Processor
Family: Pentium D
Manufacturer: Intel
ID: FD 06 00 00 FF FB EB BF
Signature: Type 0, Family 6, Model 15, Stepping 13
Flags:
FPU (Floating-point unit on-chip)
VME (Virtual mode extension)
DE (Debugging extension)
PSE (Page size extension)
TSC (Time stamp counter)
MSR (Model specific registers)
PAE (Physical address extension)
MCE (Machine check exception)
CX8 (CMPXCHG8 instruction supported)
APIC (On-chip APIC hardware supported)
SEP (Fast system call)
MTRR (Memory type range registers)
PGE (Page global enable)
MCA (Machine check architecture)
CMOV (Conditional move instruction supported)
PAT (Page attribute table)
PSE-36 (36-bit page size extension)
CLFSH (CLFLUSH instruction supported)
DS (Debug store)
ACPI (ACPI supported)
MMX (MMX technology supported)
FXSR (Fast floating-point save and restore)
SSE (Streaming SIMD extensions)
SSE2 (Streaming SIMD extensions 2)
SS (Self-snoop)
HTT (Hyper-threading technology)
TM (Thermal monitor supported)
PBE (Pending break enabled)
Version: Intel(R) Pentium(R) Dual
Voltage: 0.0 V
External Clock: 200 MHz
Max Speed: 4000 MHz
Current Speed: 2000 MHz
Status: Populated, Enabled
Upgrade: Other
L1 Cache Handle: 0x0008
L2 Cache Handle: 0x0009
L3 Cache Handle: Not Provided
Serial Number:
Asset Tag:
Part Number:
I didn't see any entry for FSB,
1PW
dmidecode allows you to "read" a system and derive the motherboard & CPU information without having to open the enclosure. From there, you can consult the specifications from the web sites of the manufacturers.
In your case, you already had the data at hand. I don't know of any performance tests that will directly measure a system's FSB speed.
Anton Ertl
> sudo dmidecode --type processor 4
...
> External Clock: 200 MHz
...
>I didn't see any entry for FSB,
It's the external clock. The FSB is quad data rate (QDR), so a 200MHz QDR FSB is usually called FSB800.
Subscribe to:
Comments (Atom)

