October 23, 2016

CentOS 7 - This Wallpapers Not For Changing

In a business and under other circumstances you may  wish to keep a constant look and feel for your desktop and not allow users to change the desktop wallpaper and screen shield. Let us make this happen.

Open a terminal and enter the command line below and press ENTER on the keyboard.

sudo vim /etc/dconf/db/local.d/00-background

Once open, insert the text below.

[org/gnome/desktop/background]

picture-uri='file:///usr/share/backgrounds/gnome/
yourimage.filename'
picture-options='zoom'
primary-color='000000'

secondary-color='000000'

[org/gnome/desktop/screensaver]
picture-uri='file:///usr/share/backgrounds/gnome/
yourimage.filename'
picture-options='zoom'


Note: Change yourimage.filename to the image file of your choosing. If it is a custom image, be sure to copy it to the path above or one of your choice.

Once done. Save and exit the file.

Next we need to lock the settings and not allow changes by the user.

Open a terminal and enter the command line below and press ENTER on the keyboard.

sudo vim /etc/dconf/db/local.d/locks/background

Once open, insert the text below.

/org/gnome/desktop/background/picture-uri
/org/gnome/desktop/background/picture-options
/org/gnome/desktop/background/primary-color
/org/gnome/desktop/background/secondary-color
/org/gnome/desktop/screensaver/picture-uri
/org/gnome/desktop/screensaver/picture-options


Once done. Save and exit the file.

Now we have added the necessary files, we must update dconf.

Still in the terminal. Enter the command line below and press ENTER on the keyboard.

sudo dconf update

Finally we need to reboot.

Still in the terminal. Enter the command line below and press ENTER on the keyboard.

sudo reboot

Once rebooted, users will no longer be able to change their desktop wallpaper or screen shield.

CentOS 7 - Change GDM Login Screen Shield Background

While it is very simple to configure and change your desktop wallpaper and  screen shield backgrounds, it is a little more involved changing the GDM login screen shield that appears after a period of time if you do not login right away.

Why would we want to change it? Have you seen it? See below.

Screen 01:


Open a terminal and enter the command line below and press ENTER on the keyboard.

sudo vim /etc/dconf/profile/gdm

Once open, insert the text below.

user-db:user
system-db:gdm
file-db:/usr/share/gdm/greeter-dconf-defaults


Once done. Save and exit the file.

Still in the terminal. Enter the command line below and press ENTER on the keyboard.

sudo vim /etc/dconf/db/gdm.d/00-login-screen

Once open, insert the text below.

[org/gnome/desktop/screensaver]
picture-uri='file:///usr/share/backgrounds/gnome/yourimage.filename'
picture-options='zoom'


Note: Change yourimage.filename to the image file of your choosing. If it is a custom image, be sure to copy it to the path above or one of your choice.

Once done. Save and exit the file.

Now we have added the necessary files, we must update dconf.

Still in the terminal. Enter the command line below and press ENTER on the keyboard.

sudo dconf update

Finally we need to reboot.

Still in the terminal. Enter the command line below and press ENTER on the keyboard.

sudo reboot

Once rebooted, you will now have your personal screen shield at login.

October 18, 2016

CentOS 7 - Virus Scanning (clamav)

Viruses are a danger to all computer users and we must guard against them. To protect against viruses you can install and use clamav.

Note: To install clamav, you must have installed and enabled EPEL. To do this you can follow our EPEL tutorial on how to install and setup EPEL.

To install clamav. Open a terminal and type in the following command and press ENTER on your keyboard.

sudo yum install clamav clamav-update

Once installed, we need to perform some configuration to allow virus definition updates. We will now update freshclam. In the terminal, type in the following command and press ENTER on your keyboard.

sudo vim /etc/freshclam.conf

Find the line near the top of the file with the word Example on it. Place a # before the word. Once done. Save and exit the file.

We can now update the virus definitions. In the terminal, type in the following command and press ENTER on your keyboard.

sudo freshclam

As CentOS uses selinux by default and should always be enabled. We will perform some configuration so clamav can access all files on disk, and update its data definition files.

In the terminal, type in the following command and press ENTER on your keyboard.

sudo setsebool -P antivirus_can_scan_system 1

If like us you prefer to automate tasks. Let us create a script and run clamav weekly then have it email us the results.

In the terminal, type the following command and press ENTER on your keyboard.

sudo vim /etc/cron.weekly/clamav_cron.sh

Input the text below.

#!/bin/sh
(
freshclam
clamscan -r -i / 
) | mail -s "clamav weekly scan..." youremail@address.com

Note: Please replace youremail@address.com with your own email address.

Note: Gmail and other mail service users that require SMTP send authentication use the text below.

#!/bin/sh
(
freshclam
clamscan -r -i /
) | mailx -v -s "clamav weekly scan..." -S smtp-use-starttls -S ssl-verify=ignore -S smtp-auth=login -S smtp=smtp://smtp.gmail.com:587 -S from="
youremail@address.com" -S smtp-auth-user=youremail@address.com -S smtp-auth-password=yourpassword -S ssl-verify=ignore -S nss-config-dir="/etc/pki/nssdb/" youremail@address.com

Note: Please replace youremail@address.com with your own email address. Also replace yourpassword with your mail service password.

Once done. Save and exit the file.

We now need to make our script executable. We do this using the command below. In the terminal, type the following command and press ENTER on your keyboard.

sudo chmod +x /etc/cron.weekly/clamav_cron.sh

You can now look forward to daily emails delivered from clamav.

October 17, 2016

CentOS 7 - An Artistic Bent - GIMP and Inkscape

Those with an artist bent and bit of a creative side can go to town on their CentOS 7 desktop install.

For raster graphics we have the one and only GIMP.

For those who like to vectorize we have Inkscape.

Let us install them.

Open a terminal and type in the following command line then press ENTER on the keyboard.

sudo yum install gimp inkscape

At the prompt to accept, type y then ENTER on the keyboard.

Once install is complete. Close the terminal by clicking on the X at the top right corner of the window.

You can now run each of the applications by clicking on Activities at the top left corner of the screen, then click on the Show Applications icon shown below.


This will bring up the menu system. Navigate and click on the icon for one of the applications you have just installed.

GIMP icon:


Inkscape icon:


Screen 01:

The GIMP.


Screen 02:

Inkscape.


Let your creative side run wild.

CentOS 7 - Install Root Kit Hunter (rkhunter)

Rootkits and backdoors are often the worst type of computer compromise possible. To protect against rootkits, backdoors and other security problems you can install and use rkhunter.

Note: To install rkhunter, you must have installed and enabled EPEL. To do this you can follow our EPEL tutorial on how to install and setup EPEL.

To install rkhunter. Open a terminal and type in the following command and press ENTER on your keyboard.

sudo yum install rkhunter

Once installed, we need to perform some housekeeping. We will now update rkhunter. In the terminal, type in the following commands individually and press ENTER on your keyboard.

sudo rkhunter --update

sudo rkhunter --propupd

To run a manual scan you can in the terminal by issuing the following command and pressing ENTER on the keyboard.

sudo rkhunter -c

If like us you prefer to automate tasks. Let us create a script and run rkhunter daily then have it email us the results.

In the terminal, type the following command and press ENTER on your keyboard.

sudo vim /etc/cron.daily/rkhunter_cron.sh

Input the text below.

#!/bin/sh
(
rkhunter --versioncheck
rkhunter --update
rkhunter -c --cronjob --enable all --disable none
) | mail -s "rkhunter daily scan..." youremail@address.com

Note: Please replace youremail@address.com with your own email address.

Note: Gmail and other mail service users that require SMTP send authentication use the text below.

#!/bin/sh
(
rkhunter --versioncheck
rkhunter --update
rkhunter -c --cronjob --enable all --disable none
) | mailx -v -s "rkhunter daily scan..." -S smtp-use-starttls -S ssl-verify=ignore -S smtp-auth=login -S smtp=smtp://smtp.gmail.com:587 -S from="
youremail@address.com" -S smtp-auth-user=youremail@address.com -S smtp-auth-password=yourpassword -S ssl-verify=ignore -S nss-config-dir="/etc/pki/nssdb/" youremail@address.com

Note: Please replace youremail@address.com with your own email address. Also replace yourpassword with your mail service password.

Once done. Save and exit the file.

We now need to make our script executable. We do this using the command below. In the terminal, type the following command and press ENTER on your keyboard.

sudo chmod +x /etc/cron.daily/rkhunter_cron.sh

You can now look forward to daily emails delivered from rkhunter.

Note: --propupd we used earlier. To read more about it, please use the following link.

rkhunter --propupd information

CentOS 7 - An EPEL A Day

To extend your CentOS 7 desktop machine, we need a larger source of applications that will be useful for both productivity, learning and fun. This is where EPEL comes to the rescue.

EPEL is:

Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL).

Download: EPEL latest

To install the package. Open a terminal and issue each of the following commands and press ENTER.

cd Downloads

sudo yum install epel-release-latest-7.noarch.rpm

After installation has completed, we need to update. In the terminal, issue the following command and press ENTER.

sudo yum update

Once complete you will be able to install packages from EPEL.

To browse EPEL packages for CentOS 7. Follow the link below.

Packages from EPEL for CentOS 7 x86_64

CentOS 7 - Extras, We No Need Any Extras

During the normal course of running a CentOS 7 desktop, you will not likely need the extras package repository.

To quickly disable it. First open a terminal and issue the following command and press ENTER.

sudo vim /etc/yum.repos.d/CentOS-Base.repo

Search for the [extras] section. After the line gpgcheck=1 insert the following.

enabled=0

Once done. Save and exit the file.

Update. In the terminal issue the following command and press ENTER.

sudo yum update

Remove CentOS 7 Login User List

Some for security reasons. Others due to using remote login servers and some because they just cannot abide user lists on login screens, prefer to remove them and drop to a layout that requires users to enter both their username and password to login.

Screen 01:

CentOS 7 default login screen using user list.


To remove the user list. We must do the following.

Open a terminal and enter the command line below and press ENTER on the keyboard.

sudo vim /etc/dconf/profile/gdm

Once open, insert the text below.

user-db:user
system-db:gdm
file-db:/usr/share/gdm/greeter-dconf-defaults


Once done. Save and exit the file.

Still in the terminal. Enter the command line below and press ENTER on the keyboard.

sudo vim /etc/dconf/db/gdm.d/00-login-screen

Once open, insert the text below.

[org/gnome/login-screen]
# Do not show the user list
disable-user-list=true


Once done. Save and exit the file.

Now we have added the necessary files, we must update dconf.

Still in the terminal. Enter the command line below and press ENTER on the keyboard.

sudo dconf update

Finally we need to reboot.

Still in the terminal. Enter the command line below and press ENTER on the keyboard.

sudo reboot

Screen 02:

Login screen without the user list.


October 16, 2016

CentOS 7 Desktop Install - I Do It My Way

We can all do default installs and get what we are given. However, if you want just gnome 3 (not classic) desktop experience and you are not too impressed by gnome documents, boxes, contacts and all those mini gnome applications that are not really useful for anything. What follows is what you can do.

Download CentOS 7 and write it to the media of your choice, then let us boot from it and begin the installation.

Screen 01:


At this screen, please select Install CentOS 7 using the arrow keys (will be highlighted in white when correctly selected) and then press ENTER on your keyboard.

Screen 02:


At this screen, please the select the language of your choice and then click on Continue.

Screen 03:


At this screen, you will be presented with sections that need to be worked through before you can proceed with the actual installation.

In the LOCALIZATION section. Check all is correct. If something is not correct, click on that section and rectify it.

In the SECURITY section.

Click on SECURITY POLICY.

Screen 04:


At this screen, you will be presented with a selection of security policies to select from. The one highlighted is the one the author uses by default.

Note: Please do not take this as a recommendation. Select the one that fits your needs.

To select a policy. Click on the one you want and then click on Select profile. Once you are happy with your selection, click on Done in the top left corner of the screen.

You will now be sent back to Screen 03.

Click on SOFTWARE SELECTION.

Screen 05:


At this screen, you will be presented with a number of software group installation options. For the purposes of this tutorial we are only after a basic gnome 3 desktop. Please click on GNOME Desktop and then Done in the top left corner of the screen.

You will now be sent back to Screen 03.

In the SYSTEM section.

Click on INSTALLATION DESTINATION.

Screen 06:


We are not going into depth on file-systems, partitioning and disk encryption in this tutorial. In this tutorial we will accept the defaults of automatic partitioning. Please click on Done in the top left corner of the screen.

You will now be sent back to Screen 03.

Scroll the screen down and then click on NETWORK & HOSTNAME.

Screen 07:


At this screen, you will need to select your preferred network interface. This will be normally a wired or wireless interface. Please select and turn on/connect as required.

At the bottom of the screen. you will see a text box labelled Host name. This is a unique name for this particular computer. Please choose one and enter it into the box. For the purposes of this tutorial we have named our computer c7-yoda.

Once you have completed these tasks. Click on Done in the top left corner of the screen.

You will now be sent back to Screen 03.

Screen 08:


Back at this screen, you will now notice that Begin Installation in the bottom right corner is now blue.

Click on Begin Installation to now begin the installation process.

Screen 09:


Once the installation process has begun, you will be presented with the CONFIGURATION screen.

Click on ROOT PASSWORD.

Screen 10:


At this screen, you need to input (twice) the root password of your choosing.

Screen 11:


Once complete, click on Done in the top left corner of the screen.

You will now be sent back to Screen 09.

Click on USER CREATION.

Screen 12:


At this screen, you need to enter your user data.

Full name: Your full name e.g. John Smith.

User name: A user name of your choosing e.g. johnsmith.

Make this user administrator: If this is your computer. Check the box and make yourself an administrator.

Password and Confirm password: Input (twice) the password of your choosing.

Screen 13:


Once complete, click on Done in the top left corner of the screen.

You will now be sent back to Screen 09.

Screen 14:


Now we make a cup of tea and wait for the installation process to complete.

After a little time...

Screen 15:


The installation process is now complete. Click on Reboot in the bottom right corner to restart the computer.

During the first boot of the installed system you will be presented with an initial setup screen.

Screen 16:


Here is time to accept the license agreement.

Do the following if you wish to accept the agreement.

Press 1 and then ENTER on the keyboard.

Press 2 and then ENTER on the keyboard.

Press c and then ENTER on the keyboard.

Press c and then ENTER on the keyboard.

The boot will now continue.

You will now be presented with the gnome login screen.

Screen 17:


You now could login and have the defaults.

Nope... Now it gets fun.

Press CTRL+ALT+F3 on the keyboard.

Screen 18:


You will be presented with the console login screen.

Type in your username and press ENTER on the keyboard.

Type in your password and press ENTER on the keyboard.

Screen 19:


Now you are logged in and have a command prompt.

We are now going to remove packages that the author deems unnecessary bloat.

Packages to be removed:

nano: How many editors do people need. vim is the way.

gnome-software: Shocking graphical package manager in gnome 3.14. We do command line package management and see what is happening.

gnome packagekit: Same as above and will also remove the graphical updater gnome-packagekit-updater.

gnome-contacts: Don't see the point of this at all.

gnome-documents: We organise my own data thanks.

gnome-clocks: We have a mobile phones and a watches. If we need around the world time we can go to timeanddate.com.

gnome-boxes: Doesn't work. Use the more powerful and flexible virt-manager.

gnome-tweak-tool: Do tweaks manually.

gnome-weather: Look out of the window.

gnome-shell-extension*: Nobody can be a shell extension fan in gnome 3.14 and by removing them all will also remove gnome-classic-session. Some people may want a gnome 2 look - Sensible people don't.

Screen 20:


Type in the command line below and then press ENTER on the keyboard.

sudo yum remove nano gnome-software gnome-packagekit gnome-boxes gnome-clocks gnome-contacts gnome-documents  gnome-weather gnome-tweak-tool gnome-shell-extension*

You will be now asked for your password. Type it and then press ENTER on the keyboard.

Screen 21:


After some processing you will be asked if you wish to commit to the changes you have asked for. Press y and then ENTER on the keyboard.

Screen 22:


The tasks will be performed and you will eventually be dropped back to the command prompt.

Screen 23:


Depending on tasks performed, the computer may need rebooting. As a precaution we will reboot anyway. Type sudo reboot and press ENTER on the keyboard. You will be prompted to enter your password. Type in your password and press ENTER on the keyboard.

Screen 24:


After the system has fully rebooted, you will be presented with the login screen. Click on your name on the screen.

Screen 25:


You will now be asked for your password. Type in your password into the box provided and click on Sign In.

Screen 26:


When entering the gnome desktop for the first time you will be presented with some initial setup screens. The first is to conform your language selection. If correct, click on Next in the top right corner of the screen.

Screen 27:


The second screen is to confirm your keyboard selection. If correct, click on Next in the top right corner of the screen.

Screen 28:


The third screen is sign in for a selection of online accounts. At this moment, it would advised you skip this step. Click on Skip in the top right corner of the screen

Screen 29:


Your all done. To finish the process, click on Start using CentOS Linux.

Screen 30:


You will now be presented with help. At this time, please click on the X at at the top right of the window.

Screen 31:


You are now on the gnome 3 desktop of CentOS GNU Linux 7.

Screen 32:


Let us navigate and move onto the next task - Updating.

Move to the top left corner of the screen and click on Activities.


Next, find the icon above and click on it. This will launch the terminal.

Screen 33:


The terminal is the most powerful and flexible tool. In time you will agree.

Screen 34:


Type in the command line below and then press ENTER on the keyboard.

sudo yum update

You will be prompted for your password. Type in your password and then press ENTER on the keyboard.

Screen 35:


Updates being downloaded ready for install.

Screen 36:


Once all updates have been downloaded. They will attempt to install. As this is a first time update, your computer will not have the updates security key installed and you will be prompted to accept it's installation. Type y and then ENTER on the keyboard.

The updates will now be installed and when complete, you will be dropped back to the command prompt.

Screen 37:


Depending on updates installed, the computer may need rebooting. As a precaution we will reboot anyway. Type sudo reboot and press ENTER on the keyboard. You will be prompted to enter your password. Type in your password and press ENTER on the keyboard.

Screen 38:


Once rebooted you will be back at the login screen. See Screens 24 and 25.

Screen 39 and 40:

Move to the top left corner of the screen and click on Activities.


Next, find the icon above and click on it. This will launch Show Applications.



Navigate these menu screens by either use the scroll wheel or your mouse or click on the circles on the right side of the screen.

Those familiar with CentOS 7 will notice, the two sub-menus (Sundry and Utilities) have gone.


There are some odd and pretty ugly icons in our new menu. Let us do some magic and make a few disappear.

Screen 41:

Move to the top left corner of the screen and click on Activities


Next, find the icon above and click on it. This will launch Files.


files is your simple graphical file manager.

Screen 42:


Once files has appeared. In the left side-menu, click on Computer. Now in the right main section of the window double click on the folder usr, then share and lastly applications.

You should now be at the same screen as in our above screenshot.

Press and hold down the CTRL key. Now scroll down and and click on the icons listed below.

IcedTea-Web Control Panel

IcedTea-Web Policy Editor

IcedTea Web Start

OpenJDK 8 Policy Tool 1.8.0.102-1.b14.el7_2.x86_64

Note: The above maybe named slightly different dependant on the update version installed on the system.

Startup Applications

Once done and while still hovering over the last icon selected. Right click to activate the menu and then click on Copy.

Screen 43:


In the left side-menu, click on Home.

Screen 44:


Move to the top right corner of the window and click on the icon above.


Click on Show Hidden Files.

Screen 45:


In the right main section of the window double click on the folder .local, then share and lastly applications.

Screen 46:


In the right main section of the window. Right click and then click on Paste.

Screen 47:

Move to the top left corner of the screen and click on Activities.


Next, find the icon above and click on it. This will launch the terminal.


Type in the command line below and then press ENTER on the keyboard.

cd .local/share/applications

Screen 48:


We are now in the terminal and located in the folder that we just copied our desktop files into. We will now append a line to the end of each file using one command. This will configure the icons not to display in our menu (see Screens 39 and 40).

Type in the command line below and then press ENTER on the keyboard.

echo "NoDisplay=true" | tee -a *.desktop

Screen 49:


What you see after using the command in the last section.

Now we can close the open windows. Click on the X at the top right of each window.

Screen 50 and 51:



Move to the top left corner of the screen and click on Activities. If you now look at the menu/applications, the icons we have hidden are no longer visible.

Screen 52:


Now we have a clean and a touch more minimal gnome 3 CentOS 7. Have fun and be productive.