Linux

Setting a default gateway in Linux

As you’ve probably figured out by now, I’m a networking noob and I’m always trying new things to gain a better understanding of how networking works. Personally, I find it fascinating, but the deeper I dig, the the deeper the whole seems to go.

One issue is that most of my test devices (mostly Raspberry Pies) need to have 2 network adapters. 1 to communicate on my lab setup and another for me to access it through SSH, which is usually through the WiFi connection. This scenario actualy works quite well until I need to access something outside of my lab environment, but must also go THROUGH my lab environment. Since the eth0 adapter is statically set and the WiFi adapter is DHCP, the Pi sets the default route through WiFi, completely bypassing my lab environment. The only way to get around this, is to set the default route through the eth0 connection manually.

To start, see where your current route is going.

route -n

*-n says to show the IP of the gateway. If you leave it off, you’ll instead see the hostname of the device instead of the ip address.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0
192.168.33.0    *               255.255.255.0   U     0      0        0 eth0

In the above example, it shows the default gateway going through 192.168.1.1 (my primary router), but instead, I need it to go through my internal network, 192.168.33.0.

Add the IP for the desired gateway

sudo route add default gw IP.ADD.RE.SS

*Replace ‘IP.ADD.RE.SS’ with the IP address of the router you want to use. In my case, the actual command is:

sudo route add default gw 192.168.33.1

Check the new route

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.33.1    0.0.0.0         UG    0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
192.168.33.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0

Now you have 2 default gateways! This will likely cause problems (well, it did for me anyway) so next we need to remove the unwanted route.

sudo route del default gw 192.168.1.1

That’s it! Check the route one last time to verify the original route is gone.

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.33.1    0.0.0.0         UG    0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
192.168.33.0    0.0.0.0         255.255.255.0   U     0      0        0 eth0

These values should only remain in place as long as the device is on. Rebooting the device should set everything back, or you can simply reverse the procedure by re-adding the old route and removing the new!

By admin on January 20, 2017 | Linux, Networking | A comment?

Install VMware Workstation Player on Ubuntu 16

I recently upgraded my trusty 2 core, 4GB desktop to a Hex core with 16 GB of ram and now I’m ready to start managing a few virtual machines. I’ve tried using VirtualBox in the past, but never got the hang of it. I’ve been using VMware Player for a couple of years and love the way it integrates with Ubuntu, especially being able to cut and paste from one to the other and to drag and drop files. Sweet.

I was surprised that it took me a few searches before I was even able to find how to download the software bundle. I guess they stopped calling it VMware Player and now call it VMware Workstation Player. Whodda thunk? Anyway, I have it now, so let’s get it installed.

 

Download VMware Workstation Player

Download the bundle from VMware using the link here. Make sure you download the player for Linux 64-bit.

 

Set bundle permissions

Before you can run the installation, you need to set the executable permissions on the file.

Open a new terminal window by pressing Ctrl + Alt + T

Move to the folder you downloaded the file into. For this example, I downloaded to my ‘Software’ folder.

cd ~/Software

Set the executable bits on the file permissions

chmod +x VMware*.bundle

 

Install VMware Workstation Player

With the execute permissions set, it’s time to install the program. Since you must be ‘root’ to install the program, we’ll use the ‘sudo’ command to execute it.

sudo ./VMware-PlayerTab Enter

.

By pressing the Tab key, the remaining part of the file name should auto-complete. If it does not, you will need to type in the full name of the file manually.
Gtk-WARNING **: Unable to locate theme engine in module_path: “murrine”,
Gtk-Message: Failed to load module “canberra-gtk-module”: libcanberra-gtk-module.so: cannot open shared object file: No such file or directory

Terms and Conditions

Once the VMware Player Installer wizard opens, read the End User License Agreement, accept the terms and conditions and click Next.
installer

Check for Updates

Select if you would like to check for product updates on startup of the program and click Next.

Usage Statistics

Select if you would like to provide VMware with anonymous system data and click Next.

License Key

Leave the license key field blank and click Next.

Install the software

On the ‘Ready to Install’ screen, click Install
install

Once the installation completes, the wizard will display ‘Installation was successful’. Click Close.

Starting VMware Workstation Player

To run the program from Unity, press the ‘Super’ key (usually looks like a Microsoft Windows Logo) on your keyboard. Now type ‘vmware’ in the search box. Ubuntu will display the VMware Player icon. Click the icon to get started.

I use this program a lot, so I recommend dragging the icon to the Launcher panel for easy access.

Email Address

As a condition to use Workstation Player for free (non-commercial) use, you must enter your email address and click OK.
email

You’re All Set

That’s all there is! You can now create and run Virtual Machines on your computer without having to shutdown or restart.

By admin on December 10, 2016 | VMware Player | A comment?

Install ownCloud Server on Ubuntu 16.04

Software Installation

Install Apache web server and dependancies

sudo apt-get -y install apache2 libapache2-mod-php7.0

Install PHP and required supporting modules

sudo apt-get -y install php php-mysql php-curl php-dom php-gd php-ldap php-mcrypt php-zip

Install MariaDB database server

sudo apt-get install mariadb-server mariadb-client

Install ownCloud server

Download the current ownCloud software

cd /var/www/html
sudo wget https://download.owncloud.org/community/owncloud-9.0.1.tar.bz2

Extract the compressed file to the ownCloud folder

sudo tar -xjvf owncloud-9.0.1.tar.bz2

Change the installation’s file permissions to use the Apache user

sudo chown -R www-data:www-data owncloud

 

Database Configuration

Configure MariaDB

Running the following command and answering the associated prompts will help secure the database.

sudo mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): Enter
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Enter
New Password: RootDatabasePassword
Re-enter new password: RootDatabasePassword
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Enter
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Enter
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Enter
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Enter
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Create the ownCloud database user and database

sudo mysql -u root -p
Enter password: RootDatabasePassword
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is ##
Server version: 5.5.47-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database owncloud;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> create user 'owncloud'@'localhost' identified by 'OwnCloudDatabaseUserPassword';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on owncloud.* to 'owncloud'@'localhost';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit

 

Configure Apache

 

owncloud.domain.com Method

Use this method if you will be accessing your ownCloud installation through a domain name vs. using an IP address as shown above.

Create the folder to store the SSL files

sudo mkdir /etc/apache2/ssl
cd /etc/apache2/ssl

Create the CSR (certificate signing request)

In order to add instant security before purchasing an SSL (Secure Socket Layer) certificate, you’ll need to create a self-signed certificate.

Use the following link to create the CSR.
http://www.howtowebhost.com/how-to-create-a-csr-certificate-signing-request-in-linux-using-openssl/

Create the Self-Signed Certificate

*Make sure you use the same files names you created in the previous steps!

openssl x509 -req -days 365 -in owncloud.domain.com.csr -signkey owncloud.domain.com.key -out owncloud.domain.com.crt

Configure Apache to use listen on Port 443

sudo a2enmod ssl
sudo service apache2 restart

Add the following lines to the Apache config file

sudo nano /etc/apache2/sites-available/owncloud.domain.com.conf
<VirtualHost *:80>
    ServerAdmin     youremail@domain.com
    ServerName      owncloud.domain.com
    DocumentRoot    /var/www/html/owncloud
    ErrorLog        /var/log/apache2/owncloud-error.log
    TransferLog     /var/log/apache2/owncloud-access.log
    LogLevel warn
</VirtualHost>
<VirtualHost *:443>
    ServerAdmin     youremail@domain.com
    ServerName      owncloud.domain.com
    DocumentRoot    /var/www/html/owncloud

    SSLEngine on
    SSLCertificateFile     /etc/apache2/ssl/owncloud.domain.com.crt
    SSLCertificateKeyFile  /etc/apache2/ssl/owncloud.domain.com.key

    ErrorLog        /var/log/apache2/owncloud-error.log
    TransferLog     /var/log/apache2/owncloud-access.log
    LogLevel warn
</VirtualHost>

Save the file

Ctrl+X
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? Y
File Name to Write: /etc/httpd/conf.d/owncloud.conf Enter

Enable the site

sudo a2ensite owncloud.domain.com.conf
sudo service apache2 reload

 

Configure ownCloud

Stop Apache

Prevent anyone from accidentally configuring ownCloud before you finish.

sudo service apache2 stop

Create the data folder

By default, ownCloud stores the files in the /data folder off of the primary website. Misconfigurations with the web server, or other issues could make the files in this folder accessible to malicious users, so we’re going to move the data to a folder outside of ownCloud’s web space.

sudo mkdir /home/ocdata
sudo chown -R www-data:www-data /home/ocdata

Setup ownCloud’s initial configuration

sudo -u www-data php /var/www/html/owncloud/occ maintenance:install --database "mysql" --database-name "owncloud" --database-user "ownCloudDBUser" --database-pass "ownCloudDBPassword" --admin-user "ownCloudAdmin" --admin-pass "ownCloudAdminPassword" --data-dir "/home/ocdata"
ownCloud is not installed - only a limited number of commands are available
ownCloud was successfully installed

* The above command took about 30 seconds to complete on my system

Enable Encryption

The following commands will enable whole-site encryption on all data uploaded to the server.

Enable ownCloud’s encryption application

sudo -u www-data php /var/www/html/owncloud/occ app:enable encryption

Create the Master Key

sudo -u www-data php /var/www/html/owncloud/occ encryption:enable-master-key
Warning: Only available for fresh installations with no existing encrypted data! There is also no way to disable it again. Do you want to continue? (y/n) Y Enter
Master key successfully enabled.

Enable all-user encryption

sudo -u www-data php /var/www/html/owncloud/occ encryption:encrypt-all

Add your domain to the “Trusted Domains”

sudo nano /var/www/html/owncloud/config/config.php

Add the following line and save the file:

  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'owncloud.domain.com',
  ),

Setup Security

At this point, your ownCloud server is ready to use. You can log in with your admin user and create other users, upload and download files, etc. However, we recommend taking a few additional steps to help secure your data from malicious users.

Change the data storage folder

By default, ownCloud stores the files in the /data folder off of the primary website. Misconfigurations with the web server, or other issues could make the files in this folder accessible to malicious users, so we’re going to move the data to a folder outside of ownCloud’s web space.

Stop the webserver

sudo service apache2 stop

Create the new data folder

sudo mkdir /home/ocdata
sudo cp -R /var/www/html/owncloud/data/. /home/ocdata/
sudo chown -R www-data:www-data /home/ocdata

Set the path in the config file

sudo nano /var/www/html/owncloud/config/config.php

Make the following edits and save the file:

  # 'datadirectory' => '/var/www/html/owncloud/data',
  'datadirectory' => '/home/ocdata',

Support Issues

Issue: WebDav errors and unable to use the desktop client.

Solution: Desktop Client version out of date

Check the Apache access log. if you see something like:

"PROPFIND /remote.php/webdav/ HTTP/1.1" 403 220

You should manually upgrade your desktop client to version 1.7 or higher

Ubuntu 14.04

1. Uninstall the current client using Ubuntu’s software package manager.
2. Run the following commands:

sudo sh -c "echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu_14.04/ /' >> /etc/apt/sources.list.d/owncloud-client.list"
sudo apt-get update
sudo apt-get install owncloud-client
By admin on May 6, 2016 | ownCloud | A comment?

Install ownCloud on Ubuntu 14.04 Using Docker

This article was written based on the exact step-by-step process used to create an ownCloud Server using Ubuntu 14.04 with Docker from a new 512MB Cloud Instance from Codero Hosting. Each step is documented starting from the initial log into the server.

Requirements:
SSH root access to the server.
Use of Nano text editor.

Update Ubuntu

apt-get -y update

As of 04-15-2016, the installed version of Docker is unsupported and must be updated.

apt-get -y upgrade

Edit the firewall to allow forwarding traffic required by oneCloud

nano /etc/default/ufw

Scroll down and change DEFAULT_FORWARD_POLICY to “ACCEPT”

#DEFAULT_FORWARD_POLICY="DROP"
DEFAULT_FORWARD_POLICY="ACCEPT"

Save and exit the file.
*the firewall should not be running yet, so we’ll leave it off for now.

Install ownCloud
Search Docker for the official ownCloud image

docker search owncloud
NAME                       DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
owncloud                   ownCloud is a self-hosted file sync and sh...   298       [OK]       
l3iggs/owncloud            The very latest ownCloud server release, a...   103                  [OK]
jchaney/owncloud           ownCloud 7 on Nginx                             48                   [OK]
pschmitt/owncloud          Reasonably configurable Docker image for t...   15                   [OK]
...

“Pull” the image to your server

docker pull owncloud

The ownCloud software will download from several sources. This may take a couple of minutes.

Verify the install was successful by checking the installed images

docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
owncloud            latest              e828d0139177        3 days ago          698.2 MB
By admin on April 16, 2016 | Applications, ownCloud | A comment?

Install ownCloud on CentOS 7

This installation assumes you are starting from a fresh CentOS 7.x Installation with no other services installed.

Update your OS

yum -y update

Install Apache, SSL, PHP, MariaDB and Nano

yum -y install httpd mod_ssl openssl php php-mysql php-posix mariadb-server mariadb sqlite php-dom php-mbstring php-gd php-pdo nano

*php-posix required for ownCloud’s occ command line configuration software.

Start Apache and MariaDB

systemctl start httpd.service
systemctl start mariadb.service

Set Apache and MariaDB to autostart on boot

systemctl enable httpd.service
systemctl enable mariadb.service

Add http and https to the firewall

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

Download ownCloud

wget https://download.owncloud.org/community/owncloud-9.0.0.tar.bz2

Install bzip2 (Required to extract the ownCloud software)

yum install -y bzip2

Extract the software

tar -jxvf owncloud-7.0.0.tar.bz2 -C /var/www/html/

Set Apache ownership permissions

chown -R apache:apache /var/www/html/owncloud/

Database Configuration

Configure MariaDB
Running the following command and answering the associated prompts will help secure the database.

mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): Enter
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Enter
New Password: RootDatabasePassword
Re-enter new password: RootDatabasePassword
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Enter
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Enter
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Enter
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Enter
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Create the ownCloud database user and database

mysql -u root -p
Enter password: RootDatabasePassword
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is ##
Server version: 5.5.47-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database owncloud;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> create user 'owncloud'@'localhost' identified by 'OwnCloudDatabaseUserPassword';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on owncloud.* to 'owncloud'@'localhost';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit

 

Configure Apache

IP.ADD.RE.SS/owncloud Method

Add the following lines to the Apache owncloud config file

nano /etc/httpd/conf.d/owncloud.conf
Alias /owncloud /var/www/html/owncloud

Options Indexes FollowSymLinks
AllowOverride Allubuntu 16.04 release date
Order allow,deny
allow from all

Save the file

Ctrl+X
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? Y
File Name to Write: /etc/httpd/conf.d/owncloud.conf Enter

 

owncloud.domain.com Method

Use this method if you will be accessing your ownCloud installation through a domain name vs. using an IP address as shown above.

Create the CSR (certificate signing request)

In order to add instant security before purchasing an SSL (Secure Socket Layer) certificate, you’ll need to create a self-signed certificate.

Use the following link to create the CSR.
http://www.howtowebhost.com/how-to-create-a-csr-certificate-signing-request-in-linux-using-openssl/

Create the Self-Signed Certificate

*Make sure you use the same files names you created in the previous steps!

openssl x509 -req -days 365 -in owncloud.domain.com.csr -signkey owncloud.domain.com.key -out owncloud.domain.com.crt

Move the certificate files to a secure location

mkdir /etc/httpd/conf/ssl
mv owncloud.domain.com.csr /etc/httpd/conf/ssl/
mv owncloud.domain.com.key /etc/httpd/conf/ssl/
mv owncloud.domain.com.crt /etc/httpd/conf/ssl/

Configure Apache to use listen on Port 443

Add the following lines to the Apache configuration file:

nano /etc/httpd/conf/httpd.conf
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

<IfModule mod_ssl.c>
    Listen 443
</IfModule>

Save the file

Ctrl+X
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? Y
File Name to Write: /etc/httpd/conf/httpd.conf Enter

Add the following lines to the Apache config file

nano /etc/httpd/conf.d/owncloud.domain.com
<VirtualHost *:80>
    ServerAdmin     red01montecarlo@yahoo.com
    ServerName    owncloud.thomasandsofia.com
    DocumentRoot    /var/www/html/owncloud
    ErrorLog        /var/log/httpd/owncloud-error.log
    TransferLog     /var/log/httpd/owncloud-access.log
    LogLevel warn
</VirtualHost>
<VirtualHost *:443>
    ServerAdmin     red01montecarlo@yahoo.com
    ServerName    owncloud.thomasandsofia.com
    DocumentRoot    /var/www/html/owncloud

    SSLEngine on
    SSLCertificateFile /etc/httpd/conf/ssl/owncloud.thomasandsofia.com.crt
    SSLCertificateKeyFile /etc/httpd/conf/ssl/owncloud.thomasandsofia.com.key

    ErrorLog        /var/log/httpd/owncloud-error.log
    TransferLog     /var/log/httpd/owncloud-access.log
    LogLevel warn
</VirtualHost>

Save the file

Ctrl+X
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? Y
File Name to Write: /etc/httpd/conf.d/owncloud.conf Enter

Restart MariaDB

#

systemctl restart httpd.service
systemctl restart mariadb.service

 

Install ownCloud and configure the Admin user

Using the Command Line

Create occ alias

Since we’ll be using the ownCloud occ (ownCloud Console), and this command must be ran as the web server user, create an alias to reduce typing.

alias occ="sudo -u apache /var/www/html/owncloud/occ"

Install ownCloud and setup the database

occ maintenance:install --database "mysql" --database-name "owncloud" --database-user "ownCloudDBUser" --database-pass "ownCloudDBPassword" --admin-user "ownCloudAdmin" --admin-pass "ownCloudAdminPassword"
ownCloud is not installed - only a limited number of commands are available
ownCloud was successfully installed

Complete Setup Using Web Interface

IP.ADD.RE.SS/owncloud Method

Type the IP address of your server directly into your browser’s address bar, followed by /owncloud
owncloudBrowser1

owncloud.domain.com Method

Enter https://owncloud.domain.com (replace “domain.com” with your actual domain) directly into your browser’s address bar.
owncloudBrowser2

Enter your Administrator username and password

In the “Create an admin account, enter the username and password you wish to use for your administrator.

It is strongly recommended NOT to use “admin” or “administrator” since these are easily guessed. Using other usernames adds an extra layer of security to your system.

owncloudAdminPass

Configure the Storage location

To access the storage and database configuration settings, click “Storage & database” located directly under the “Create and admin account” window.

The default storage path for this configuration is “/var/www/html/owncloud/data”. Leave this as it is for now. We will manually adjust it in the upcoming steps.

owncloudstorage

Configure the Database

In the “Configure the database” window, click “MySQL/MariaDB”, then enter the username, password and database name you used when you configured the database earlier. Leave “localhost” as it is to ensure remote users cannot access the database.
ownclouddbsetup1

Save the settings

Click the [Finish setup] button at the bottom of the page.

Exit

Close your web browser. We have some more command line work to do!

 

Secure the data folder

By default, ownCloud installs the data folder directly on the website’s document root. This could allow access to the folder if the site’s .htaccess or folder’s index file becomes corrupt. Instead, we’ll move it to an “off-site” folder.

Move the data/ folder

mv /var/www/html/owncloud/data /home/owncloud-data

*It has been noted by other users that using “/home/owncloud/data” or other matching folder naming techniques tend to fail, so we use “/home/owncloud-data” which has proven to work.

Configure ownCloud to use the new location

nano /var/www/html/owncloud/config/config.php

Now change the following line:

'datadirectory' = '/var/www/html/owncloud/data',

To:

'datadirectory' = '/home/owncloud-data',

Save the change

Ctrl+X
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ? Y
File Name to Write: /var/www/html/owncloud/config/config.php Enter

Restart Apache

systemctl restart httpd.service
By admin on April 1, 2016 | Applications, Cloud, Linux | A comment?