IntroductionRegardless of the function a server is to perform, except STORE (which makes the data area available to itself), the data area will be linked. The , the first step is to mount the STORE to the machine. The first VM to be set up should therefore be the role STORE. Linking the data areaFirst a connection to the common data area is established. To do this, the 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: | Translations Ignore |
|---|
| Code Block |
|---|
| title | Connect Datastore - create directory |
|---|
| mkdir /home/jtel/shared
chown jtel:jtel /home/jtel/shared |
|
Mount with Credentials in fstabThe mount IThe connection is then configured in the /etc/fstab file. The file can be edited with a text editor. The following entry must be inserted into the file as an example (replace password with the corresponding password): | Translations Ignore |
|---|
| Code Block |
|---|
| title | Additional entry in / etc / fstab |
|---|
| 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 |
, or the following command will append the required line to the file: | Status |
|---|
| colour | Red |
|---|
| title | Caution Password |
|---|
|
ATTENTION: to connect old file shares (SMB 1.0) under CentOS 7.x the following entry is necessary: | Translations Ignore |
|---|
| Code Block |
|---|
title | Additional entry in / etc / fstab |
|---|
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,vers=1.0 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 fileTo 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: | Status |
|---|
| colour | Red |
|---|
| title | Caution Password |
|---|
| The first block of the line describes the UNC of the release. Here the name of the computer (here acd-lb) must be adapted if necessary. The third block contains among other things the credentials for sharing. If a domain name is also required here, it can be added with an additional parameter domain=DOMAINNAME separated by commas. If it is desired for security reasons not to store the credentials in the /etc/fstab file, which for system-immanent reasons has no special reading restrictions, they can be stored in a separate file. Such a file would then have the following format (replace password with the appropriate password):| Translations Ignore |
|---|
| Code Block | title |
|---|
| File with separate access data | domain=MYDOMAIN
username=jtel
password=<password> |
| This file can be placed in any useful location (e.g. root home directory or directly in the /etc directory) and can be given read-only access to root. Assuming that such a file would be named /etc/jtel-credentials, the file's permissions are secured with the following commandsNext, secure the file permissions: | Translations Ignore |
|---|
| Code Block |
|---|
| language | bash | title | Backup of the access data file |
|---|
| chown root:root /etc/jtelstore-credentials
chmod 400 /etc/jtelstore-credentials |
| In the file And finally, add the /etc/fstab the entry would then look like this: | Translations Ignore |
|---|
| Code Block |
|---|
| title | Secure entry in / 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 |
|
ATTENTION: to connect old file shares (SMB 1.0) under CentOS 7.x the following entry is necessary: | Translations Ignore |
|---|
| Code Block |
|---|
| title | Secure entry in / etc / fstab |
|---|
| cat <<EOFF >> /etc/fstab
//acd-store/shared /home/jtel/shared cifs cifs credentials=/etc/jtel-credentials,uid=jtel,gid=jtel,file_mode=0755,dir_mode=0755,vers=1.0 0 0 0 0
EOFF |
|
Mount STOREThe After configuring the connection, the share can now be mounted. This is done with the command: | Translations Ignore |
|---|
| Code Block |
|---|
| language | bash |
|---|
| title | Connect the share |
|---|
| mount /home/jtel/shared |
|
After connectingmounting, a short test shows that the files can be accessed: | Translations Ignore |
|---|
| Code Block |
|---|
title | Access test |
|---|
[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 mountMountAdjust the crontab so Adding the following to crontab will ensure that the mount itself is restored, so that the boot order of the systems is not importanteven if STORE is rebooted: | Translations Ignore |
|---|
| Code Block |
|---|
| language | bash | title | Securing the mount |
|---|
| 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: | Translations Ignore |
|---|
| Code Block |
|---|
| language | bash | title | Testing ensuring the mount |
|---|
| 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) |
|
|