Saturday, December 21, 2013

Rsync + SSH - no password




Install rsync
For Ubuntu or Debian
# apt-get install rsync
For SUSE or Fedora# yum install rsync
rsync without prompting for password:
Assuming the file server is ServerF and backup server is ServerB

Genarate the public key in ServerF
$ ssh-keygen
$ Enter passphrase (empty for no passphrase):
$ Enter same passphrase again:

The public key will be generated and stored in
~/.ssh/id_rsa.pub

Copy public key to remote host
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.1.100
Or
ssh-copy-id -i ~/.ssh/id_rsa.pub "root@192.168.1.100" -p123
Or

Open id_rsa.pub, copy the content
Login to ServerB using the same user in the rsync command
In ServerB, append the contents to ~/.ssh/authorized_keys. Create the file if not exist. Make sure the file mode is 700.

Is it possible to run ssh-copy-id on port other than 22?
Rsync with SSH without prompting for password

Sunday, December 15, 2013

Microsoft Windows - Client Operating Systems - API unity


Why Microsoft needs three or more operating systems

   A common operating system core, with common APIs and capabilities, is inevitable, and it is logical. Microsoft might even start to use common branding, most likely with Windows Phone becoming just "Windows." But that doesn't mean that it won't actually have three operating systems. Windows on a phone will be different from Windows on a tablet—in much the same was as iOS on the iPhone is different from iOS on the iPad. The user interface will be tailored to the form factor, making the two close siblings but not identical.

This will result in Windows for ARM phones, Windows for ARM tablets, and Windows for x86/x64 PCs. One might even make a case for a fourth to be added into the mix: Windows for x86 phones.

More exotic is the Xbox One operating system. This has no branding of its own, as it's never decoupled from the Xbox One hardware


A completely different API? That’s a different OS !


The operating system that is meaningfully different is Windows Phone. Windows Phone 7 used Windows CE (Microsoft's lightweight, customizable, embedded operating system) as its kernel. At the time, Windows CE was Microsoft's only ARM-compatible operating system, and the company had considerable experience using it on smartphones (as it was also used in Windows Mobile). This seemed like a sensible decision. Third-party applications were built using a modified version of Silverlight with a .NET environment .


For Windows Phone 8, Microsoft wanted to use the NT kernel. The NT kernel is more capable and is where most of Microsoft's development effort is spent, so this made sense for the company (if not for end users). Since the development of Windows RT meant that the Windows software stack ran on ARM, there was no longer any reason to stick with Windows CE. Accordingly, Windows Phone 8 shares major parts with Windows 8, with low-level components such as the network stack and security infrastructure in common between the operating systems.

To support existing Windows Phone 7 apps, Windows Phone 8 included essentially the same Silverlight environment. New applications for Windows Phone 8, however, didn't use the Silverlight environment. They have a couple of options: a new .NET environment similar to the old Silverlight one (though this time built on the full .NET runtime and notably missing the XNA 3D graphics API that the Silverlight system supported) and native code C++ with Direct3D.

Significantly, Windows Phone apps can't use Windows' Win32 API. Nor can they use most of the new WinRT API.

Developers wanting to share code between their phone and tablet software aren't completely out of luck: it's possible to write .NET code that conforms to a common subset of functionality that's available on both Phone and regular Windows (producing what are called "Portable Class Libraries"). Windows Phone 8 also gives C++ developers access to a limited subset of the WinRT API (sometimes called WinPRT), and large parts of Direct3D. Sources speaking to Paul Thurrott claim that overall, there's about a 33 percent commonality between the phone and non-phone operating systems.

This makes Windows Phone 8 a strange orphan operating system. Windows Phone 8 has few APIs in common with either Windows or Windows RT, so while iOS and Android phone apps can also be used on iOS and Android tablets, Windows Phone apps are strictly for the phone alone !

Universal binariesMicrosoft is currently pushing the notion of universal binaries that would let developers create a single app that can run both on Windows RT and Windows Phone. Where Windows Phone 8 has 33 percent "API unity" with Windows RT, Windows Phone 8.1 will hit 77 percent.

Saturday, December 7, 2013

Fedora 19 : S.M.A.R.T. - SMARTd - SMARTctL - SMARTmonTools - gSMARTcontroL




Monitoring Hard Disks with SMART

When a failure is anticipated by S.M.A.R.T., 
the user may choose to replace the drive to avoid unexpected outage and data loss.

Fedora comes with a "smartd" service that will email root if serious problems are detected on disks.

[root@server ~]# yum provides smartd
Loaded plugins: langpacks, refresh-packagekit
smartmontools-6.1-1.fc19.x86_64 : Tools for monitoring SMART capable hard disks
Repo        : fedora
Matched from:
Filename    : /usr/sbin/smartd

smartmontools comes with two programs:
   - smartctl : meant for interactive use
   - smartd   : continuously monitors S.M.A.R.T.


Check smartctl daemon service
   # service smartd status



[root@abxrds ~]# 
[root@abxrds ~]# service smartd status
Redirecting to /bin/systemctl status  smartd.service
smartd.service - Self Monitoring and Reporting Technology (SMART) Daemon
   Loaded: loaded (/usr/lib/systemd/system/smartd.service; enabled)
   Active: active (running) since Fri 2013-12-06 22:27:46 EET; 2h 30min ago
 Main PID: 9625 (smartd)
   CGroup: name=systemd:/system/smartd.service
           └─9625 /usr/sbin/smartd -n -q never

Dec 06 22:27:46 abxrds smartd[9625]: Device: /dev/sdb, type changed from 'scsi' to 'sat'
Dec 06 22:27:46 abxrds smartd[9625]: Device: /dev/sdb [SAT], opened
Dec 06 22:27:46 abxrds smartd[9625]: Device: /dev/sdb [SAT], ST2000DM001-9YN164, S/N:Z1E2JV3Q, WWN:5-000c50-04f5f87f8, FW:CC4G, 2.00 TB
Dec 06 22:27:46 abxrds smartd[9625]: Device: /dev/sdb [SAT], found in smartd database: Seagate Barracuda 7200.14 (AF)
Dec 06 22:27:46 abxrds smartd[9625]: Device: /dev/sdb [SAT], WARNING: A firmware update for this drive is available,
Dec 06 22:27:46 abxrds smartd[9625]: see the following Seagate web pages:
Dec 06 22:27:46 abxrds smartd[9625]: http://knowledge.seagate.com/articles/en_US/FAQ/207931en
Dec 06 22:27:46 abxrds smartd[9625]: http://knowledge.seagate.com/articles/en_US/FAQ/223651en
Dec 06 22:27:47 abxrds smartd[9625]: Device: /dev/sdb [SAT], is SMART capable. Adding to "monitor" list.
Dec 06 22:27:47 abxrds smartd[9625]: Monitoring 2 ATA and 0 SCSI devices
[root@abxrds ~]# 

To ensure that your drive supports SMART, type:
smartctl -i /dev/sda 

SMART will also give you a lot of detailed information about the drive : 
smartctl -a /dev/sda

[root@gate ~]# smartctl -a /dev/sda
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.11.6-200.fc19.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate SV35
Device Model:     ST2000VX000-1CU164
Serial Number:    S1E2D65T
LU WWN Device Id: 5 000c50 062131fc0
Firmware Version: CV22
User Capacity:    2,000,398,934,016 bytes [2.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Sat Dec  7 00:38:33 2013 EET
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:  (0x82) Offline data collection activity
was completed without error.
Auto Offline Data Collection: Enabled.
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: (   97) 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: (   1) minutes.
Extended self-test routine
recommended polling time: ( 223) minutes.
Conveyance self-test routine
recommended polling time: (   2) minutes.
SCT capabilities:       (0x10b9) SCT Status supported.
SCT Error Recovery Control supported.
SCT Feature Control supported.
SCT Data Table supported.

SMART Attributes Data Structure revision number: 10
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   113   099   006    Pre-fail  Always       -       54914664
  3 Spin_Up_Time            0x0003   095   095   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       43
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   069   060   030    Pre-fail  Always       -       9313921
  9 Power_On_Hours          0x0032   099   099   000    Old_age   Always       -       1483
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       43
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0
189 High_Fly_Writes         0x003a   072   072   000    Old_age   Always       -       28
190 Airflow_Temperature_Cel 0x0022   066   065   045    Old_age   Always       -       34 (Min/Max 22/35)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       15
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       43
194 Temperature_Celsius     0x0022   034   040   000    Old_age   Always       -       34 (0 17 0 0 0)
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%      1482         -
# 2  Short offline       Completed without error       00%      1478         -
# 3  Short offline       Completed without error       00%        42         -

SMART 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.

[root@gate ~]# 


Check the overall health:
smartctl -H /dev/sda
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.11.6-200.fc19.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED



Testing a Drive


You may run any type of test while the drive is mounted although there may be some drop in performance. There are three types of test that can be conducted on a drive:
  1. Short
  2. Extended (Long)
  3. Conveyance
To find an estimate of the time it takes to conduct each test, type:
sudo smartctl -c /dev/sda 

The most useful test is the extended test (long). You can initiate the test by typing:
sudo smartctl -t long /dev/sda 

Results


You can view a drive's test statistics by typing:
sudo smartctl -l selftest /dev/sda 

Suggested application: GSmartControl

[root@gate ~]# yum install gsmartcontrol
Loaded plugins: langpacks, refresh-packagekit
Package gsmartcontrol-0.8.7-2.fc19.x86_64 already installed and latest version

















Thursday, November 28, 2013

Sendmail ‘collect: premature EOM: unexpected close’



Sendmail 

‘collect: premature EOM: unexpected close’


If you are getting a ‘collect: premature EOM: unexpected close’ in your mail logs, or if you have people complaining that they cannot send email to your server and you have this error, then there's a solution to the problem.


I had over time installed several Blacklist denials in my sendmail.mc config file, and that perhaps one of these was not responding anymore.
By commenting out each Blacklist deny one at a time, I discovered which one was no longer responding. To comment out a line in the main sendmail.mc file, simply put dnl at the start of the line. 

FEATURE(`dnsbl’,`sbl-xbl.spamhaus.org’,`550 Denied RBL $&{client_addr} by sbl-xbl.spamhaus.org”’)dnl
FEATURE(`dnsbl',`dnsbl.sorbs.net',`"554 Rejected " $&{client_addr} " Found in dnsbl.sorbs.net"',`t')dnl

Tuesday, November 12, 2013

Android Pushes Past 80% Market Share

http://www.idc.com/getdoc.jsp?containerId=prUS24442013
http://www.zdnet.com/windows-phone-gains-but-android-rules-7000023096/
http://www.gartner.com/newsroom/id/2623415


 IDC found that "By itself, Nokia accounted for 93.2 percent of
all the Windows Phone-powered smartphones shipped during the quarter"


Top Four Operating Systems, Shipments, and Market Share, Q3 2013 (Units in Millions) 

Operating System
3Q13 Shipment Volumes
3Q13 Market Share
3Q12 Shipment Volumes
3Q12 Market Share
Year-Over-Year Change
Android
211.6
81.0%
139.9
74.9%
51.3%
iOS
33.8
12.9%
26.9
14.4%
25.6%
Windows Phone
9.5
3.6%
3.7
2.0%
156.0%
BlackBerry
4.5
1.7%
7.7
4.1%
-41.6%
Others
1.7
0.6%
8.4
4.5%
-80.1%
Total
261.1
100.0%
186.7
100.0%
39.9%
Source: IDG (November 2013)




Samsung smartphone sales surge,
while Apple gets a small boost from iPhone 5S




Worldwide Smartphone Sales to End Users by Vendor in 3Q13 (Thousands of Units)
Company
3Q13
Units
3Q13 Market Share (%)
3Q12
Units
3Q12 Market Share (%)
Samsung
80,356.8
32.1
55,054.2
32.1
Apple
30,330.0
12.1
24,620.3
14.3
Lenovo
12,882.0
5.1
6,981.0
4.1
LG Electronics
12,055.4
4.8
6,986.1
4.1
Huawei
11665.7
4.7
7,804.3
4.5
Others
102941.8
41.1
70206.8
40.9
Total
250,231.7
100.0
171,652.7
100.0
Source: Gartner (November 2013)




Will Windows Phone overtake the iPhone in Europe in 2014?


The latest report from Kantar Worldpanel ComTech has plenty of good news for Windows Phone.
In Italy Windows PHone has a 16.1% market share to the iPhone's 10.1%.



Apple Gets “Significant Bounce” On 5c, 5s iPhones; Android Still Trumps With 71% Share Of All Sales


Kantar Worldpanel ComTech, the WPP market research division that provides a rolling check-in on how smartphones are selling in key markets, has put out its latest figures this morning covering the 12 weeks that ended October 31. It looks like the debut of new iPhones from Apple have given the company a “signficant bounce” in sales. But even with the launch of not one but two new models — the colorful 5c and elegant 5s — the impact of incremental upgrades has not been as strong as last year’s debut of the iPhone 5. All in all, Kantar says Android took 71% of all sales across 12 key markets versus 21% for the iPhone.
Specifically, in important markets like the U.S., Android took nearly 53% of sales. In Europe, Android accounted for nearly 71% of sales collectively across Britain, Germany, France, Italy and Spain.