Introduction

Regardless of the function a server is to perform, except STORE, the first step is to mount the STORE to the machine. The first VM to be set up should therefore be the role STORE.

Configure STORE Mount

First a directory to mount STORE is created. STORE will be mounted in /home/jtel/shared. The path for the mount point is created with the following commands:

mkdir /home/jtel/shared
chown jtel:jtel /home/jtel/shared

Mount with Credentials in fstab

The mount is then configured in the /etc/fstab file. The file can be edited with a text editor, or the following command will append the required line to the file:

CAUTION PASSWORD

cat <<EOFF >> /etc/fstab
//acd-store/shared    /home/jtel/shared    cifs    user=jtel,password=<password>,uid=jtel,gid=jtel,file_mode=0755,dir_mode=0755    0    0
EOFF

Notes:

  • If an external STORE is being mounted, it my be necessary to supply a domain name. In this case add the following in the options part of the fstab entry:
  • domain=DOMAINNAME

Mount with external Credentials file

To mount with the credentials stored in a separate file, proceed as follows.

Create a file, for example in /etc/store_credentials with the following content:

CAUTION PASSWORD

domain=MYDOMAIN
username=jtel
password=<password>

Next, secure the file permissions:

chown root:root /etc/store-credentials
chmod 400 /etc/store-credentials

And finally, add the /etc/fstab entry:

Secure entry in / etc / fstab
cat <<EOFF >> /etc/fstab
//acd-store/shared    /home/jtel/shared    cifs    credentials=/etc/jtel-credentials,uid=jtel,gid=jtel,file_mode=0755,dir_mode=0755    0    0
EOFF

Mount STORE

The share can now be mounted. This is done with the command:

mount /home/jtel/shared

After mounting, a short test shows that the files can be accessed:

[root@acd-db2 ~]# ls -la /home/jtel/shared/
total 52
drwxr-xr-x.  9 jtel jtel 4096 Mar 30 10:35 .
drwx------.  6 jtel jtel 4096 Jun 12 17:03 ..
drwxr-xr-x.  5 jtel jtel 4096 Mar 22 12:13 Data
drwxr-xr-x.  4 root root 4096 Jun 14 08:37 Import
drwxr-xr-x.  7 jtel jtel 4096 Jun 13 15:37 JTEL
drwxr-xr-x. 16 jtel jtel 4096 Mar 23 15:55 JTELCarrierPortal
drwxr-xr-x.  3 jtel jtel 4096 Jun 13 15:40 LogFiles
drwxr-xr-x.  3 jtel jtel 4096 Feb 10 12:49 LogFilesCall

Securing the Mount

Adding the following to crontab will ensure that the mount is restored, even if STORE is rebooted:

cat <<EOFF >> /etc/crontab
*/1  *  *  *  * root bash -c "if [ ! -d /home/jtel/shared/Data/system ]; then mount /home/jtel/shared ; fi"
EOFF

This can be tested as follows:

ls /home/jtel/shared
(files are there and are listed)
 
umount /home/jtel/shared
ls /home/jtel/shared
(files are no longer there and are not listed)

... Wait up to one minute
 
ls /home/jtel/shared
(files are there and are listed)


  • No labels