About Tek Eye

The blue one-eyed robot.

hiberfil.sys Windows 8.1 Delete to Free Up SSD Space

Disable Hibernation on Windows 8.1 to Remove hiberfil.sys for More Disk Space

This article provides a tutorial on removing the Windows hibernation file to free up disk space when a small solid state disk (SSD) is used as the system drive. Please ensure you have a backup of any data and files you need to keep before changing system configurations. This article is for information only. System configurations can vary widely, therefore any changes made are at your own risk. If you’re confident with computers and understand the meaning of the hiberfil.sys file you can skip to the end of the article for the relevant command, which is to run powercfg -h off at the administrator’s command prompt, otherwise read on for a better understanding.

Background

Low Disk Space on a Windows SSDApart from low end systems a SSD drive is standard fitting to most computers and laptops. An SSD is also a common upgrade to older systems. A SSD is more expensive than a hard disk drive, as a result small capacity SSDs (less than 128 GB) may be used to keep costs down. Windows 8.1 requires 20GB for installation, modern computing demands soon eats into the the remaining space. A system can be configured to use a small SSD for the Windows system and a large multi-terabyte  hard drive for data storage (see Move My Documents and Other Personal Folders). Despite this, or if a second drive is not an option, the SSD may fill up quickly with normal use. Once the SSD is full the computer or laptop will not function properly, may not boot up, or show error messages at boot time. The worst case scenario is data corruption and loss, or even disk failure, when applications cannot handle running with no disk space available. Continue reading

Visualization for Cyber Security Conference List of Papers

All Papers from the Annual Visualization For Cyber Security Symposium

Whilst researching novel methods for visualising data from computer security systems the VizSec conference proceedings looked interesting. VizSec is short for Visualization for Cyber Security. This is an annual symposium dedicated to the use of visualisation techniques to help with the complexity of monitoring the large modern systems we all use. System security has become a big data problem and only efficient data analytics will help manage it.

The 11th International Symposium on Visualization for Cyber Security takes place in November 2014. The papers from the previous 10 years of symposiums are available from different institutional or publisher web sites. This means there is not a single search available to get one list of all the papers presented at VizSec over the years. Therefore visits to several web pages and web sites are required to put together the list of all papers presented at VizSec. Since this has now been done that list is published here. Therefore you don’t need to repeat the work. Continue reading

Webmin CentOS Install for Easier VPS Management

Manage a CentOS VPS Using Webmin for System Administration

A Virtual Private Server (VPS) is a cost effective way to host web and cloud based solutions or high volume web sites. A VPS provides more resources (memory, processing power and disk space) than shared hosting without the cost of leasing dedicated hardware (although a VPS will not be as powerful as a dedicated machine). Some VPS packages only provide a minimal Linux system. Access to that minimal system is usually via a secure shell (SSH). Managing a Linux system remotely over SSH can be cumbersome. To make the system administration easier a web based management tool is useful. A commercial tool such as cPanel is often provided at extra cost. Open source alternatives like ZPanel and Webmin are available. In this tutorial article the Webmin system administration tool will be installed on a CentOS based VPS. CentOS, based on a Red Hat Linux distribution, is commonly available for VPS packages. This article assumes that the minimal installation of CentOS is used for the VPS operating system. The minimal CentOS does not have the desktop environment installed. The steps for the Webmin CentOS install are:

  1. Update CentOS using yum update.
  2. Add Webmin to the CentOS yum repositories.
  3. Add the Webmin package PGP key to the RPM keyring.
  4. Allow Webmin through the CentOS iptables firewall.
  5. Install Webmin using yum install webmin.
  6. Start Webmin and start using it.

Webmin Install Running on CentOS Continue reading

Android Bitmap Loading for Efficient Memory Usage

Load a Bitmap from Resources Correctly

When handling bitmaps it is not long before Android developers come across the error “java.lang.OutOfMemoryError: bitmap size exceeds VM budget“. This usually occurs when the bitmaps are large (several megabytes uncompressed),  or running the code on older devices, or trying to load lots of bitmaps. This occurs because Android was design for mobile devices with limited resources, including memory, and bitmaps can require large amounts of memory. Despite Android not dealing with multi-megabyte bitmap loading automatically it can still be done. Instead of loading the whole bitmap a reduced resolution version is loaded (via a technique called subsampling). Android bitmap loading is achieved via the BitmapFactory class. The Options settings passed to the class can reduce the size of the bitmap, saving on memory usage.

Bitmaps can be BIG but Android Screens are Small

A digital image from a camera can be between 5 and 18 megapixels (MP) in size, depending upon the camera or device. This is the uncompressed size. The actual file storing the image, usually a JPEG file, is smaller than the displayed image because of compression. High end cameras can produce 20 MP or higher images. A 5 MP image can have a resolution of 2560×1920, that is greater than high definition (HD) television at 1920×1080, and bigger than the resolution of the Goggle Nexus 10 tablet device at 2560×1600. What about a 18 MP image? A size of 5184×3456!  A Nexus 5 phone has a HD screen, so why load more than 2 MPs of data if the screen can only display a maximum of 2 MPs. By using subsampling the huge photo image being viewed on the Android device only consumes as much memory as required to display it, 2 MP for a HD resolution screen. This saves precious App memory and reduces the possibility of out of memory errors. Here’s an example of loading large bitmaps on different Android devices. A 1000×1000 placeholder image was loaded into an ImageView  and the App run on two devices. One with a HVGA, 320×480, screen and another with a QVGA, 240×320 screen.

Android Bitmap on Different Screens

On the HVGA screen the 1000×1000 image is shown at 320×320, on the QVGA screen it is shown at 240×240. So the one million pixel image only requires a hundred thousand or sixty thousand pixels for actual viewing on these devices. Loading only the required size for display makes sense. On the Android Developers website there is an article on Managing Your App’s Memory and in the section Avoid wasting memory with bitmaps it states: “When you load a bitmap, keep it in RAM only at the resolution you need for the current device’s screen, scaling it down if the original bitmap is a higher resolution.

Android Bitmap Loading Code from the Developer Site

There is a series of lessons on the Android Developers site called Displaying Bitmaps Efficiently that deal with correctly loading, caching and processing bitmaps. When processing multiple large bitmaps it needs to be done away from the User Interface (UI) thread using AsyncTask, with the use of caching when appropriate. There is a sample App for the lessons, DisplayingBitmaps.zip, for Android Studio, though the code can be used in Eclipse if that is your preferred development platform. The example App was previously called Bitmap Fun from BitmapFun.zip. The basic steps in loading a large bitmap are:

  1. Determine the required size (from a known size or determining the size of the target View).
  2. Use the BitmapFactory class to get the bitmap’s size (set inJustDecodeBounds in BitmapFactory.Options to true).
  3. Using 1. and 2. calculate the subsampling value (a multiple of 2) and pass it to the BitmapFactory.Options setting inSampleSize.
  4. Use the BitmapFactory to load a reduced size bitmap.

The following section takes the code from the Android Developers article Displaying Bitmaps Efficiently to provide an example App performing the steps listed above.

Sample Code to Load an Android Bitmap from a Large Resource Image

J. M. W. Turner The Fighting Temeraire A large bitmap is needed. You may be reading this because you have a very large bitmap causing out of memory errors. Here a large image of a Turner painting is used. The image size is 5684×4226, a 24 MP image! You can grab the image from Wikimedia Commons, it is available in several sizes.

An Android App project was created in Eclipse. The large Turner image was added to the project in a folder called drawable-nodpi under the res folder. A large placeholder image (large enough to match the screen width) was also added to the folder. It can be generated from Placeholder Graphic at openclipart.org. The layout is just an ImageView with a Button below it:

Here’s the code for the App:

And the App in action:

Large Android Bitmap Loading

Using a Open Source Library to Manage Large Bitmap Loading in Android

This code is good for a single bitmap, but the Android Developers article goes on to talk about caching and background loading. One way of achieving this is to use an existing implementation, such as provided in the Display Bitmaps sample or existing libraries that support large bitmap loading with caching, including android-query (AQuery),  Android Volley for loading images over networks and Android Universal Image Loader.

Related Article

How to Get a View Size in Android

Change SSH Port from Default for CentOS Security Improvement

Help Harden a CentOS Server, Change SSH Port from Default Port Number 22

Edit the SSH configuration file to modify SSH port number. The configuration file is sshd_config. Adding Port XXXX where XXXX is the required port number. Then update SELinux and iptables. This is done to help harden CentOS against the less skilled hackers. The Secure Shell (SSH) is used to access a CentOS Server from another computer. For example when accessing a Virtual Private Server (VPS) to perform configuration changes. CentOS is a common option for a VPS operating system. This tutorial provides details on changing the SSH default port number for a CentOS server.

Steps to Change the CentOS SSH Port Number

The following steps are performed to change default SSH port number on CentOS:

  1. Login to the CentOS server.
  2. Back up then edit the /etc/ssh/sshd_config file.
  3. Add the line Port XXXX to the file, where XXXX is the new port number.
  4. Update the SELinux policy for the new SSH port.
  5. Update the iptables firewall rule for the new SSH port.
  6. Restart the services or the server.
  7. Check the changes worked by connecting on the new port.

Practice and Keep A Back Up

CentOS Logo

It is recommended to practice the instructions that follow on a local test environment before doing it on a live machine. This ensures familiarity with the process and reduces the risk of making mistakes on a live server. CentOS can be configured on a local Virtual Machine (VM) to practice these changes (see the Further Information section at the end of the article). For a remote VPS if you make a mistake reconfiguring the SSH port you may not be able to connect to it. It will require resetting via your service provider’s control panel. Always ensure you have a backup of any data that needs to be kept in the event the VPS needs to be reset. If SSH is the only option for configuration of a remote VPS consider other hardening options first, for example adding a sudo user for SSH login and removing the root user login over SSH. This article uses the shell (command line terminal) to change the CentOS configuration, based on a minimal CentOS install.

Edit the File sshd_config

To change the SSH port number edit the /etc/ssh/sshd_config file. Start by taking a copy in case anything goes wrong. For all commands in this article only enter the text after the # or $ prompt character, as seen on the terminal screen. Here’s the command to copy sshd_config to sshd_cfg_old:

# cp /etc/ssh/sshd_config /etc/ssh/sshd_cfg_old

Editing is done with vi or nano. On a minimal CentOS install, typical for a VPS, nano will not be installed by default. To edit sshd_config using vi:

# vi /etc/ssh/sshd_config

Or if logged in as a user with sudo ability:

$ sudo vi /etc/ssh/sshd_config

Add the Required Port Number

Select a new port number above 1024, one that is meaningful to you so it is remembered, or pick a random one. See List of TCP and UDP Port Numbers on Wikipedia. Some admins just double up port numbers, e.g. 22 becomes 2222, but that is familiar to hackers so pick something else, e.g. pick a memorable year and double it. For example 2×1066 is 2132, so port 2132 can be remembered as “Twice Battle of Hastings“.

The Port line should be in the first page of the file, as either Port 22 or commented out as #Port 22. Go to the line. Press Insert to enter edit mode. Remove the # if present and change the port number to the required value. Press the Esc key to return to command mode and enter :wq to write out the file and quit vi.

ssh_port_config

Update SELinux with the New Port Number

If the Security Enhanced Linux module (SELinux) is running then update selinux with the new port number. Failure to update SELinux for the new port will result in a Permission denied showing in the SELinux log.  To check that selinux is enabled run sestatus:

# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted

Use semanage to add the new port number to SELinux, see the article RHEL 6: semanage SELinux Command Not Found on how to install the command if not present (e.g. if using the CentOS minimal install). For this article this command was used to check the package for semanage:

# yum provides /usr/sbin/semange

And this command to install it:

# yum -y install policycoreutils-python

The port numbers for SELinux can be displayed using a semanage command (pipe to less to page through the list):

# semanage port -l | less

In the list of ports will be found ssh_port tcp 22. Use semanage to add the new port number:

# semanage port -a -t ssh_port_t -p tcp 2132

Update Firewall Rules for the New Port Number

The iptables firewall rules are listed using:

#iptables -L

There will be a rule showing that SSH is only allowed on port 22. This needs changing to the new port number. Use vi to open /etc/sysconfig/iptables:

# vi /etc/sysconfig/iptables

Go to this line:

-A INPUT -p tcp -m state –state NEW -m tcp –dport 22 -j ACCEPT

Change 22 after –dport to the new port number, e.g. 2132 (press Insert to enter edit mode in vi):

-A INPUT -p tcp -m state –state NEW -m tcp –dport 2132 -j ACCEPT

Save and exit (Esc key then :wq). Restart iptables:

# service iptables restart

Restart SSH

With the SSH config file changed, SELinux updated and iptables rules updated SSH can be restarted:

# /etc/init.d/sshd restart

Restarting CentOS

As an alternative to restarting iptables and ssh restart the the CentOS server:

# reboot

or

# shutdown -r now

Login to CentOS Using SSH to Test The New Port

On a Windows system a program such as PuTTY can be used to access a CentOS server using SSH. In this example the port number is 2132. To connect with the new port number enter it in the Port box.

PuTTY to SSH into different port

With the host name or IP address also entered select Open. The terminal prompt should appear allowing for a normal login.

(Note: If accessing a CentOS VPS on a VirtualBox virtual machine on the local computer you will need to change the Network Address Translation port from 22 to the new number, see the third article listed below.)

Further Information

List of IDEs for Android App Development, Which is Best for You?

Eclipse Alternatives for Android Application Development

An Integrated Development Environment (IDE) is an all-in-one solution that allows an application (app) developer (a.k.a. programmer) to perform the software development cycle repeatedly and quickly. That cycle is to design, write (or code), compile, test, debug and package the app software. For Android app development Google currently supports two IDEs (but read on for a list of alternative IDEs and languages):

  1. Android Developer Tools (ADT) – http://developer.android.com/sdk/index.html
  2. Android Studio – http://developer.android.com/sdk/installing/studio.html (in beta)

Both of these IDEs require the use of the Java computer language to write Apps. The first option uses the well established Eclipse IDE. The second option is based upon the IntelliJ IDE.

The Google IDEs and the Java language are not the only options for Android App development. Some developers might not need the power of Java or just don’t get on with C style languages. Some developers would like a single code base to support other platforms: Apple (iOS), Windows, Blackberry and the Web (HTML5). This is known as cross-platform development. Well there are plenty of alternatives to Google’s tools, see the following table for a list of Android app development IDE and computer language alternatives. Code can be written in different languages, like BASIC, HTML5 or Lua. Many of the alternatives are free to use, some open source, some restricted versions of paid for products. A few may not have a free version. Some will require the Android Software Development Kit (SDK) that comes with the Google tools to be installed. It is possible to install several IDEs onto the same computer to try them out.

List of Alternative Android App Development IDEs

Name Language C-P URL
AIDE (Android IDE) HTML5/C/C++ Yes http://www.android-ide.com/
Application Craft HTML5 Yes http://www.applicationcraft.com/
Basic4Android BASIC No http://www.basic4ppc.com/
Cordova HTML5 Yes https://cordova.apache.org/
Corona Lua Yes http://coronalabs.com/
Intel XDK HTML5 Yes https://software.intel.com/en-us/html5/tools
IntelliJIDEA Java No https://www.jetbrains.com/idea/features/android.html
Kivy Python Yes http://kivy.org/#home
Lazarus IDE+free pascal+LAWM Pascal Yes http://www.lazarus-ide.org/, http://www.freepascal.org/, LAWM
MIT App Inventor Blocks Yes http://appinventor.mit.edu/explore/
Monkey X BASIC Yes http://www.monkeycoder.co.nz/
MonoGame C# Yes http://www.monogame.net/
MoSync HTML5/C/C++ Yes http://www.mosync.com/
NS BASIC BASIC Yes https://www.nsbasic.com/
PhoneGap HTML5 Yes http://phonegap.com/
RAD Studio XE Object Pascal, C++ Yes http://www.embarcadero.com/
RFO Basic BASIC No http://laughton.com/basic/
RhoMobile Suite Ruby Yes http://www.motorolasolutions.com/US-EN/Business+Product+and+Services/Software+and+Applications/RhoMobile+Suite
Telerik HTML5 Yes http://www.telerik.com/platform#overview
Titanium JavaScript Yes http://www.appcelerator.com/titanium/titanium-sdk/
Xamarin C# Yes http://xamarin.com/

Table Notes:

  1. C-P, Cross-Platform, if No only Android supported, if Yes supports App production for other platforms (you will need to check if your required platform is supported).
  2. Language, HTML5 also includes the related technologies of Cascading Style Sheets (CSS) and JavaScript.
  3. AIDE and RFO Basic allows code to be developed on the go on Android devices. The code can be packaged into full blown Apps.

Support for Android Programming

This above list of free and commercial IDEs for Android shows that other languages can be considered when wanting to develop apps. Some of these Android options provide cross platform development from the same app source code. (For some IDEs the Android SDK will need to be installed.) Purchased commercial Android development packages will come with varying degrees of support from the company and the user base. Open source and free packages will be supported by the user and development community, and sometimes paid for support is available. Forums are a useful source of answers for Android development issues.

Microsoft are developing Cordova support for Visual Studio, see Microsoft’s Multi-Device Hybrid Apps web page.

Android NDK

Google provides for free the Native Development Kit (NDK) that allows programming in C or C++, see the Android NDK page for more information. Use the NDK to optimise time critical portions of an App. Google does not recommend it for general App development.

Setting Up Google’s Android IDEs

If you need help installing Eclipse or Android Studio see our articles. For a quick Eclipse set up see:

For Android Studio set up see:

For a step-by-step set up of Eclipse see:

Please let us know of any other Android development options you come across. It would be interesting to hear of any App successes from using any of the above packages, drop us a line at dan@tekeye.biz.

CentOS Version Command and Update CentOS to New Version

View the CentOS Version and Update with Shell Commands

CentOS is a popular Linux Operating System for enterprise computing, web servers and Virtual Private Servers.

In this article:

  • View CentOS version
  • Check if CentOS is 64-bit or 32-bit
  • View the Centos server Name
  • View CentOS kernel version
  • View list of available CentOS updates
  • Updating CentOS
  • Rebooting CentOS
  • Listing CentOS installed packages

In these examples root is the logged in user, in practice a different superuser will normally be used when maintaining a server. These commands are executed in the shell.

View CentOS Version

When CentOS boots the version is briefly displayed on a boot screen and may be configured to show on the shell login but will probably show the kernel version:

Centos 
Kernel 2.6.32-431.el6.i686 on an i686

servername login:

Once logged in at the CentOS shell prompt find the CentOS version using:

[root@servername ~]# cat /etc/*release
CentOS release 6.5 (Final)

or

[root@servername ~]# cat /etc/issue
CentOS release 6.5 (Final)

or

[root@servername ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)

Check if CentOS is 64-bit or 32-bit

To check if CentOS is 64-bit or 32-bit use the uname command with the -p option (p for processor):

[root@servername ~]# uname -p
x86_64

The 64-bit CentOS will display x86_64 and 32-bit will display i686.

Display the CentOS Server Name (Host Name)

Use hostname to display the systems name:

[root@servername ~]# hostname
servername.server

Display the CentOS Kernel Version

Use uname to see the kernel version:

[root@servername ~]# uname -r -v
2.6.32-431.el6.i686 #1 SMP Fri Nov 22 00:26:36 UTC 2013

List Available CentOS Updates

List available updates using yum, here piped (using |) to less to view one screen at a time using the space bar. Use q to quit the listing:

[root@servername ~]# yum list updates | less

Update CentOS

Update CentOS using yum, package downloads may need to be confirmed:

[root@servername ~]# yum update

(Note: After confirming the update packages will download, extract and install. If this fails you may see messages such as “Trying other mirrors”“Error Downloading Packages” and “[Errno 256]”. Use the command “yum clean metadata”  and try “yum update” again. If it still reports errors use the command “yum clean all” and try again.)

Rebooting CentOS

Restart CentOS:

[root@servername ~]# reboot

or

[root@servername ~]# shutdown -r now

One logged back in use the commands above to check the updated versions:

[root@servername ~]# uname -r -v
2.6.32-504.3.3.el6.i686 #1 SMP Tue Dec 16 22:55:44 UTC 2014

[root@servername ~]# cat /etc/issue
CentOS release 6.6 (Final)

List CentOS Installed Packages

List installed packages using yum, piped to less to view a page at a time (to quit):

[root@servername ~]# yum list installed|less

Further Information

For more information on CentOS see their Wiki and the CentOS web site at centos.org.

See also:

New User for CentOS VPS Created Using SSH

Create a New User CentOS Account on a VPS

A tutorial to add a user using SSH to access a CentOS VPS (the method applies to other Linux versions). In summary the steps are:

  1. Use useradd to add the new user.
  2. Use passwd to create the user’s password.
  3. Use visudo to make the user a sudoer.
  4. Login as the new user to test the sudo ability.

What’s Required for This Tutorial

The use of a Virtual Private Server (VPS) to run systems in the Cloud is a core aspect of modern computing (see What is a VPS?). Being able to access a VPS via a secure shell (SSH) is an essential skill. This tutorial shows how to add a new user to a VPS via SSH. It assumes that a VPS is installed and running and that a SSH client is available. It is recommended that a test system is used to become familiar with the process. This example uses a virtual machine (VM) running a minimal install of CentOS. The PuTTY program is used to access the CentOS VM.

To replicate this set up on a Windows machine follow these articles:

It is assumed that the live VPS system has a default operating system (OS) install. If a hosting company is providing the VPS they should have helpful documentation providing an overview of what is installed and how to access, configure and stop and start the VPS. Hopefully the default root superuser login has been given a strong password which was provided when the VPS account was obtained.

Security is a Top Priority

Once a VPS is up and running adding a new user account is one of the first tasks to do. For management purposes the default root user is not used for day-to-day (general administration) operations. This reduces the risk of inadvertent changes. A new user can be set up to do common administration tasks. The new user can temporarily elevate their privileges to perform the admin task. Note that not all users are given this ability. Only those who are trusted and need it for their work role.

Choosing Good User Names and Passwords

Do not use simple user names that are easily guessed, such as useradminguestdemotest etc. A combination of letters and numbers is better. For example someone called John Doe could have JDoe478 where the number part is the employee number, or John478DOE. The user name needs to be both easy to remember (for the user) but not immediately obvious (to help security). Notice the use of mix case to aid with the security.

A good password is a long string of random looking numbers, letters and punctuation. Words that can be found in dictionaries and common passwords such as password, 123456, letmein etc. are very poor. One way to generate a good password is to visualise a phrase that is personal and take the letter of each word of the phrase. For example: My mother lives at number 27 she likes squirrels’ fluffy tails. This produces Mmlan27slsft, which has mixed case and numbers and is of a reasonable length.

 Log in as root to Create the New User CentOS Account

Run a SSH client, here PuTTY is used on a Windows machine. Enter the appropriate IP address and port number for the VPS (on the test configuration it is localhost and 2222, on a live system it will be a valid IP address and likely port 22 for SSH).

If connecting for the first time an alert confirmation message will need to be accepted, select Yes to accept the message. Log in as root. Enter the root password and the prompt will be displayed.

Using PuTTY for SSH New User CentOS

Issue the useradd command with the required user name (the command adduser is a synonym for useradd). Note in this article a hash sigh, #, is used to indicate the end of the prompt line on the terminal. Type everything after the #.

# useradd JDoe478

Create the new users password with the passwd command, typing it twice.

# passwd JDoe478
Changing password for user JDoe478.
New password:
Retype new password:
passwd: all authentication tokens updated successfully

A warning is displayed if the password is considered weak. Run passwd again if required.

(To list users use cat /etc/passwd which shows the user names and other information, such as user id and group. Use cat /etc/passwd | cut -d “:” -f1 to list just the names. System defined users will be in the list.)

Add the New User CentOS Account to the Root Privileges

For the new user to be able to run admin commands, just like root, the sudoers configuration file must be update with the new user’s log in name. This is done with the visudo command.

# visudo

Move the cursor down to MACHINE=COMMANDS section. How the section is commented may vary between operating systems. For the CentOS 6.5 minimal version, used in this example, place the cursor just after:

## Allow root to run any commands anywhere
root    ALL=(ALL)    ALL

Press the a key to enter add (insert) mode. Duplicate the root line for the new user:

JDoe478    ALL=(ALL)    ALL

Thus the MACHINE=COMMANDS section will now have:

## Allow root to run any commands anywhere
root             ALL=(ALL)    ALL
JDoe478    ALL=(ALL)    ALL

Press the Escape key then enter the write and quit command with :wq (colon w q). The new user is now able to perform system administration commands.

Run a new PuTTY session to test the new user. The last character of the command line will be a $ to indicate a standard user.

Super User Do – sudo

Once logged in under the new account use the sudo command to run a privilege command. For example the visudo command was used by root to edit the sudoers configuration. Trying to run visudo under the new user will fail with Permission denied.

$ visudo
visudo: /etc/sudoers: Permission denied

As the new user, with root privileges, run visudo with sudo short for super user do:

$ sudo visudo

The password for the new user (not the root user) is requested. This is used to confirm the action to execute a root level command (and also log the action).

$ sudo visudo
[sudo] password for JDoe478

If you see:

visudo: /etc/sudoers: Permission denied

The password may be entered incorrectly. If a message starting with the user name and continuing with “is not allowed to run sudo on srv” is displayed. Check the above steps to ensure the user and sudoers configuration are set correctly. Sometimes the word ALL in the MACHINE=COMMANDS section is spelt incorrectly with lowercase l instead of uppercase L.

Another sudo example is the shutdown command. Run a restart command without sudo:

$ shutdown -r now
shutdown: Need to be root

And with sudo:

$ sudo shutdown -r now
[sudo] password for JDoe478:

Broadcast message from JDoe478@test.server
The system is going down for reboot NOW!

Remember that executing a root command using sudo requires the user to re-enter their password, ensuring confirmation of the command (and logging it in the system). To finish SSH sessions use logout or exit.

Summary on Configuring a New User in CentOS Via SSH

  • Use a SSH terminal client program to access the VPS.
  • Login as a user with root privileges.
  • Use useradd (or adduser) to add the new user (e.g. useradd JDoe478).
  • Use passwd to set the users password (e.g. passwd JDoe478).
  • Add the new user to the MACHINE=COMMAND section in the sudoers configuration file (e.g. JDoe478    ALL=(ALL)    ALL) with visudo.
  • When logged in under the new user use the sudo command to run root commands (e.g. sudo shutdown -r now).

We Made It Into The Icons of The Web, What’s Next

What Does It Take To Make The Top 0.1% of Web Sites?

Not much. But a lot more than what the other 99.9% of web sites achieve.

So there are about 861 million web sites in the world running on 265 million domains, all served up by 108 million hosts (see our article How Many Websites Are There In The World?). The Internet analytics company Alexa only tracks the top 1 million web sites and just lists the top 500. What does it take to get into the top 1 million, or the top 500, or even the top 10.

Icons of the Web

The Icons of the Web project by nmap.org (the Nmap Security Scanner) used the Alexa rankings data. From the data Nmap generated a visual representation of the popularity of the world’s top web sites. This site managed to squeeze in, just. Somewhere around the point of the blue arrow shown in this picture.

The Nmap Icons of the Web Project

Notice how most of the top 1 million websites (including this site) are tiny little dots compared to the big, globally dominating websites. The relative popularity of the website is shown by the size of it’s icon (favicon). Getting into the top 1 million websites means you are in the top 0.1% of all the worlds websites. However, making a leap to the top of website charts would be a real success story.

What Are Your Site’s Aims?

What did it take for this site to make the top 0.1%. This site is about adding a valuable resource to the Internet. And looking at all the top sites that is what they all do. They are a resource for the people that visit them. Even if in some cases that resource is of a questionable nature!

When measuring web site success one metric is page views by real people. Our traffic levels are modest, about 10,000 page views per month. Drop below 8000 page views per month and you drop out of the top 1 million sites. To get to the top 500 list of websites the traffic needs to reach several million page views per month! A top 10 entry needs several 100 million pages views per month!

This site is not looking for a top 10 or top 500 place. However, a modest increase (double) in page views would send the site up several hundred thousand places in the rankings. How will that be achieved? By doing what all successful websites do. Providing good quality content and resources. If you are looking to run a successful web site or on line business remember that a fast website with quality resources, products and services will rise up the rankings. (If you want some help to achieve that get in touch, dan@tekeye.biz.)

This year this site will be moving to a new location to help increase page views and continue growing. More news on the move will come closer to the time. In the meantime hopefully you will find something useful within the current content, as well as or future articles, so why not add us to your list of favourites.