Bash Scripting Introduction – LinuxAdmin.io

Bash Scripting Introduction

Essentially bash scripting is just linking commands together. You can perform many tasks consistently using predefined scripts allowing them to become repeatable and standardized. If you are looking for more information you can check out the bash man page.

Each script should start with a “shebang” telling which environment to interpret the script, bash scripts start with

#!/bin/bash

In CentOS/RHEL 7 , /bin/sh is symlinked to /bin/bash

To make a script execute, you can either call it via the interpreter

/bin/bash myscript.sh

Or change the permissions to make it executable

chmod ug+x myscript.sh

and then execute it directly

./myscript.sh

Bash Test Comparison Operators

Test comparison operators are use to compare two pieces of information.

String Tests:

Are used to compare to strings together

$x = $y – if $x is equal to $y, this will be true
$x != $y – if $x is not equal to $y, this will be true

Integer Tests:

Integer tests are used to compare to integers together

$x -eq $y – if $x is equal to $y this will be true.
$x -ne $y – if $x is not equal to $y, this will be true.
$x -ge $y – if $x is greater than or equal to $y, this will be true.
$x -gt $y – if $x is greater than $y, this will be true.
$x -le $y -if $x is less than or equal to $y, this will be true.
$x -lt $y – if $x is less then $y, this will be true.

Bash Test Operators

Test operators are used to test if a condition is true.

-d FILE – True if file is a directory.
-e FILE – True if file exists.
-f FILE – True if exists and is a file.
-r FILE – True if file exists and is readable.
-w FILE – True if file exists and is granted write permissions.
-x FILE – True if file exists and is granted execute permissions.

Bash If Statements

To utilize the above test operators, you will need to use ‘if’ statements

To use a comparison:

if [ $x -eq $y ]; then
echo “x equals y”;
else
echo “x does not equal y”;
fi

To use a test operator:

if [ -d /home ]; then
echo “/home exists”;
else
echo “/home does not exist”;
fi

Bash Loops

For Loops

Loops can be utilized to do the same task multiple times

for i in ; do
echo “I have a $”;
done

The output will be

I have a apple
I have a orange
I have a watermelon

While Loops

These are done, while something is true perform the following task

i=0
while [ $i -le 5 ]
do
echo “i is currently at $”;
((i++))
done

The output will be:

i is currently at 0
i is currently at 1
i is currently at 2
i is currently at 3
i is currently at 4
i is currently at 5

Bash Script Arguments

You can use arguments to pass stored data into a script and store it as a variable. The first argument is stored as $1, the second argument is stored as $2 and so on.

if [ $1 -eq $2 ]; then
echo “The arguments are equal”;
else
echo “The arguments are not equal”
fi

The output would be

./compare_arguments 3 5
The arguments are not equal

./compare_arguments 4 4
The arguments are equal

You can also require a certain number of arguments be entered by using $#

if [ $# -ne 2 ]; then
echo “the number of required arguments is 2”;
exit;
fi

Which indicates if the number of required arguments is not 2, then exit.

Jul 16, 2017LinuxAdmin.io

Source

Univention Corporate Server (UCS) 4.2 Installation and Review on VMware Workstation

Univention Corporate Server (UCS) 4.2 Installation
Univention Corporate Server (UCS) 4.2 Installation on VMware Workstation

This video tutorial shows

Univention Corporate Server (UCS) 4.2 Installation and Review

on VMware Workstation/Player step by step. This tutorial is also helpful to install Univention Corporate Server 4.2 on physical computer or bare-metal server hardware. We also install

VMware Tools

(Open VM Tools) on UCS 4.2 for better performance and usability features.

Univention Corporate Server (UCS) 4.2 Installation Steps:

  1. Download Univention Corporate Server (UCS) 4.2 ISO
  2. Create Virtual Machine on VMware Workstation/Player
  3. Start Univention Corporate Server Installation
  4. Install VMware Tools (Open VM Tools)
  5. Univention Corporate Server (UCS) 4.2 Review

Installing Univention Corporate Server (UCS) 4.2 on VMware Workstation

 

Univention Corporate Server (UCS) 4.2 New Features and Improvements

Univention Corporate Server (UCS)

is a Debian-based Linux distribution for enterprise server environments. UCS 4.2 shifts the distribution’s base from Debian 7 to Debian 8 which also transitions UCS from using SysV init to the systemd init software. The entire Debian distribution will no longer be rebuilt. This allows security updates to be released even faster, and binary compatibility is increased. This change also involves the switch of the default start-up system to systemd. However, all previous init scripts are still started, so that the apps can be migrated successively. A configurable web portal provides an overview of the services installed in the domain. If there is more than one UCS system in the domain, an overview of servers is displayed.

Univention Corporate Server Website:

https://www.univention.com/

  1. With Univention Corporate Server 4.2, the second minor release of Univention Corporate Server (UCS) is now available. It provides several substantial feature improvements and extensions, new properties as well as various improvements and bugfixes. An overview of the most important changes:
  2. UCS 4.2 is based on Debian GNU/Linux 8 (Jessie). More than 16,000 source packages have been updated and adapted to the needs of UCS administrators. Selected core components, e.g. Linux Kernel (4.9), Docker (1.12) or QEMU (2.8) are more recent in UCS compared to Debian GNU/Linux 8.
  3. From UCS 4.2, the management system offers a central portal for quick access to all applications in the environment, as well as the management of the various UCS instances. This allows users to access their applications more easily. The portal is configurable and can be adapted to individual needs.
  4. The design and user experience have been improved further with UCS 4.2. For example, the password self service provides a simplified usage. The management system now uses SAML (Web Single Sign-On) by default, provided that the prerequisites, such as working name resolution, are given.
  5. Samba has been updated to version 4.6.1. This includes various improvements in the areas of DRS replication, Active Directory compatibility, file services and printer handling, among other things. In addition, the performance has been improved in environments with many users.

Hope you found this Univention Corporate Server (UCS) 4.2 Installation and Review tutorial helpful and informative. Please consider sharing it. Your feedback and questions are welcome!

Source

Install Packet Tracer on Ubuntu 18.04 LTS

If you’re a newbie in networking trying to get certifications such as Cisco CCENT or CCNA, then Packet Tracer will be a great help to you.

Cisco Packet Tracer is a network simulation software for simulating Cisco networking devices. You can use Cisco Packet Tracer to design simple to pretty complex network topologies. You can also configure the virtual computers, routers, switches etc in Packet Tracer to test your network topology.

Cisco Packet Tracer can also be used to simulate wireless networks, IP telephony networks (VoIP) and many more.

If you’re aiming for Cisco certification such as CCENT, CCNA etc, then you can use Cisco Packet Tracer to learn to configure Cisco networking devices (such as Switches and Routers) using Cisco IOS commands.

In this article, I will show you how to install and use Cisco Packet Tracer on Ubuntu 18.04 LTS. Let’s get started.

Source

Linux Today – Pagely NorthStack Makes WordPress Serverless

Oct 19, 2018, 13:00

(Other stories by Sean Michael Kerner)

The new NorthStack platform disaggregates the usual stack that WordPress requires into a series of services that largely run on serverless infrastructure at Amazon Web Services (AWS). The NorthStack effort is an attempt to lower the fixed costs and infrastructure needed to deploy and run WordPress.

“WordPress itself is based on 12 year old code, it does not want to be in a serverless environment,” Joshua Strebel, CEO of Pagely told eWEEK. “WordPress wants to live on one AWS EC2 node up next to its’ database with everything all contained in it.”

Complete Story

Related Stories:

Source

Aspyr Media are getting a little help from Intel for the long-delayed Linux patch to Civilization VI

The patch to bring cross-platform online play for Linux players of Civilization VI has been long delayed, with Aspyr Media now getting a little help from Intel.

After cross-platform originally being planned for early in 2017, Linux gamers have sadly been left waiting. By the looks of it, we’re also behind on normal patches right now too.

Writing on Steam earlier, a rep from Aspyr Media said this:

[…] This issue naggingly staying around is certainly not due to lack of effort on our part.

I’ll also remind the forum that xplatform is confirmed fixed in this patch.

Also, in reply to a user jokingly telling them to blink if it’s a third-party issue, they said:

Lol…no blinks…this one is on us. Intel has been kind enough to jump in and help.

We still don’t know exactly what the issue is, since Aspyr Media haven’t said. They gave a hint that it was due to a serious crash on a specific Intel chipset although they’re likely not able to give out any technical details on it.

Thinking of picking up Civilization VI for Linux? Head to Humble Store or Steam.

Source

Give Your Desktop A Sweet Outlook With Sweet Themes – NoobsLab

It is feels bit difficult to describe this theme we are going to introduce here today.

Sweet

theme pack looks and feel very different on the desktop but at the same time make the Linux desktop elegant and eye catching. Maybe these are not perfect looking themes available but it lineup in the perfect theme queue. You may say, I don’t like it in screenshots, let me tell you that you should install it on your system and if you don’t like then you already have option to remove it. So there is no harm to try a new thing, maybe this is next best theme pack for your Linux desktop.

There is not much information available about themes on its page; this pack offers three variants Sweet, Sweet-Ambar and Sweet-Dark, you can choose whatever fits your needs. These themes are available for Gtk-3 and Gtk-2, and targets multiple desktop environments such as Gnome, Gnome Shell, Cinnamon, Xfce, Mate, Budgie etc. We are offering Sweet themes via our PPA for Ubuntu/Linux Mint. If you are using distribution other than Ubuntu/Linux Mint then download directly from theme page and install it on this location “~/.themes” or “/usr/share/themes”. If you find any kind of bug or issue within this theme then report it to author and hopefully it will get fixed very soon in the next update.

sweet theme

sweet theme
sweet theme

Available for Ubuntu 18.04 Bionic/18.10/and other Ubuntu based distributions
To install Sweet theme pack in Ubuntu/Linux Mint open Terminal (Press Ctrl+Alt+T) and copy the following commands in the Terminal:
That’s it

Source

Snaps for Linux are a massive success

One of the big knocks against Linux-based operating systems is lack of software. The truth is, there are countless excellent programs for both productivity and fun. One fair criticism, however, is fragmentation between distributions. For end users, it can be difficult installing an app that isn’t designed for their distro. And yeah, that has been a pain point for years.

Thankfully, Canonical — maker of Ubuntu — aimed to alleviate that problem with Snaps. These containerized packages can be installed on pretty much any Linux distribution, making things easier for both users and developers. But has the organization’s standard been a success? Apparently, very much so. As a way to celebrate yesterday’s release of Cosmic Cuttlefish, Canonical shares the following infographic.

ALSO READ

As you can see below, not only are there many Snaps available, but there are several top-tier programs, such as Slack, Firefox, Spotify, Plex, Skype, and more! After reviewing the infographic, please head to the comments below and share your thoughts.

Photo Credit: WAYHOME studio/Shutterstock

Source

The Featureful Release of Nextcloud 14 Has Two New Security Features

Last updated September 14, 2018 By John Paul

Nextcloud is an open source cloud storage and collaboration platform that you can host on your own servers. It’s considered one of the best cloud storage available for Linux. Even if you cannot host Nextcloud on your own, you can opt for one of the Nextcloud providers for a small fee.

Recently, Nextcloud announced the release of version 14 of their software. The update brought improved security, collaboration features, and more. Let’s take a look.

New features in Nextcloud 14

Nextcloud wallpaper

Here are the main new features in the latest release of Nextcloud.

1. Video Verification [Security Feature]

When you share your files and documents with others on the web, there is always a chance that someone else will intercept that information. Nextcloud 14 allows you to video chat with the person you plan to share your information with, to make sure that they are who they say they are.

2. Improved 2-Factor Authentication [Security Feature]

2-Factor Authentication (2FA) is a common method of protecting access to your information. Instead of just relying on a password, 2FA requires a second form of digital verification. Nextcloud 14 now supports the use of “the secure messaging apps Signal and Telegram” and SMS to verify your identity.

3. Collaboration

Nextcloud allows you to edit or comment on files shared with you. Now, if you accidentally delete a file that has been shared with you, you can easily recover it. Files can also be shared with groups on other Nextcloud servers using federation.

4. Group Communication

Video calling has been a big feature of Nextcloud and received some work.

  • Join without Camera or Microphone
  • Join multiple chats in different browser tabs at the same time
  • Conversations can be pinned to the top of the conversation list
  • Chat works without requesting Camera/Microphone
  • Participants can be @mentioned in the chat now
  • Display number of unread chat messages + special highlight when you got mentioned in the conversation list
  • System chat messages (basically inline activity stream for the respective conversation)

5. Improved Server Management

The system administrator tools have been improved, as well. The user management system was optimized to support a larger number of users. The update process has been improved to show administrators what changes will be made by the updater and if there are updates to the installed apps.

6. Privacy Compliance

Nextcloud 14 is compliant with the European GDPR and the upcoming California Consumer Privacy Act. Release 14 includes a “Data Protection Confirmation app and separate audit log file”. Between the available Nextcloud applications and the included documentation, enterprises can very easily make sure that they are compliant with the current privacy regulations.

How to get Nextcloud 14

If you want to try Nextcloud 14 right now, you can download it from their website. If you already have Nextcloud 13 installed, you will be able to upgrade to 14. However, you probably won’t have the option to do so right away. Nextcloud will be rolling out the update incrementally, If you are in a hurry, you can get it right away by switching to the beta update channel. just be sure to set it back to the normal update channel after it installs. However, it would be a good idea to wait before upgrading to avoid system crippling bugs.

Do you have Netcloud 14 install? If so, do you like the new features? If not, will these new features persuade you to install it? Let us know in the comments below.

If you found this article interesting, please take a minute to share it on social media, Hacker News or Reddit.

About John Paul

My name is John Paul Wohlscheid. I’m an aspiring mystery writer who loves to play with technology, especially Linux. You can catch up with me at my personal website

Source

How to check which libraries are used by a program or process on Linux ?

To find out what libraries a particular executable depends on, you can use ldd command. This command invokes dynamic linker to find out library dependencies of an executable.[ram@linuxforfreshers.com]$ldd /usr/bin/ssh linux-vdso.so.1 => (0x00007ffe099dc000) libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f578f64a000) libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f578f26e000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f578f069000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f578ee50000) libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f578ec35000) libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f578e9ed000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f578e628000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f578e3ea000) /lib64/ld-linux-x86-64.so.2 (0x000055f5ccd53000) libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f578e11e000) libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f578deef000) libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f578dceb000) libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f578dadf000) libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f578d8db000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f578d6bc000)Note that it is NOT recommended to run ldd with any untrusted third-party executable because some versions of ldd may directly invoke the executable to identify its library dependencies, which can be security risk.Instead, a safer way to show library dependencies of an unknown application binary is to use the following command.objdump -p /path/to/program [ram@linuxforfreshers.com]$objdump -p /usr/bin/ssh | grep NEEDED NEEDED libselinux.so.1 NEEDED libcrypto.so.1.0.0 NEEDED libdl.so.2 NEEDED libz.so.1 NEEDED libresolv.so.2 NEEDED libgssapi_krb5.so.2 NEEDED libc.so.6

Check shared library dependencies of a running process

If you want to find out what shared libraries are loaded by a running process, you can use pldd command, which shows all shared objects loaded into a process at run-time. lsof -P -T -p Application_PID

Source

Install And Configure ProFTPD On CentOS

ProFTPD Installation

ProFTPd is an Open source FTP daemon, widely used for its granular configuration ability. This is a guide to provide install methods for both CentOS 7 aswell as CentOS 6 and below. You can read more about ProFTPD on the project’s website.

Install ProFTPD

ProFTPD is in the EPEL repository, you will need to install that first:

yum -y install epel-release

Run a yum update to ensure everything is up to date

yum -y update

Install ProFTPD

yum -y install proftpd

Configure ProFTPD

nano /etc/proftpd.conf

Change the server name:

ServerName “ProFTPD server”

To your servers hostname. Go ahead and save the file afterwards.

Enable and Start Proftpd

Go ahead and restart the service and enable it.

On CentOS 7:

Restart the service:

systemctl restart proftpd

Make sure the service will start after a reboot:

systemctl enable proftpd

On CentOS 6(and below):

Restart the service:

service proftpd restart

Make sure the service will start on reboot:

chkconfig –add proftpd
chkconfig proftpd on

Enable FTP in the firewall

If you are currently using a firewall, you will need to allow incoming FTP connections.

Firewalld

Allow the port for incoming:

firewall-cmd –permanent –add-port=21/tcp

then reload the firewall:

firewall-cmd-reload

Iptables

Add the new rule:

iptables -A INPUT -p tcp -m tcp –dport 20:21 -j ACCEPT

Save the new firewall ruleset:

iptables-save > /etc/sysconfig/iptables

Enabling passive connections in ProFTPD

Passive mode can sometimes resolve certain clients ability to connect to the FTP server which may have been blocked by firewalls. If you are having issues connecting remotely, would like you to try to to enable passive connections in ProFTPD you will need to edit /etc/proftpd.conf

nano /etc/proftpd.conf

And add the following lines:

PassivePorts 60000 65535
AllowStoreRestart on
AllowRetrieveRestart on
TimeoutNoTransfer 65535
ListOptions “-la”
TimeoutIdle 65535

You will then also need to add the passive range in the firewall

Iptables:

Add the new rule:

iptables -A INPUT -p tcp -m tcp –dport 60000:65535 -j ACCEPT

Save the ruleset:

iptables-save > /etc/sysconfig/iptables

Firewalld:

Add the new port range:

firewall-cmd –permanent –add-port=60000-65535/tcp

Reload the firewall:

firewall-cmd-reload

Testing The FTP Service

You can test the FTP configuration locally first to ensure the daemon is running by using netstat

# netstat -plan|grep :21
tcp6 0 0 :::21 :::* LISTEN 22089/proftpd: (acc

You can also connect locally by installing the ftp client

yum install -y ftp

And then making a connection to the localhost or 127.0.0.1

# ftp localhost
Trying ::1…
Connected to localhost (::1).
220 FTP Server ready.
Name (localhost:root):

And enter and valid username and password and it should authenticate. If it does not let you in, the authentication messages are written to /var/log/secure.

Jul 17, 2017LinuxAdmin.io

Source

WP2Social Auto Publish Powered By : XYZScripts.com