Task 1 – UserAdmin (ACL - projecta)
Task 2 – NFS (/jobs mount and export)
Task 3 – Samba (/home shared as “homes”)
Task 4 – Backup Script (differential)
UserAdmin
a] Server1 and Server2 # groupadd -g 1100 engineers
b] Server1 only:
vi /etc/login.defs umask 077
vi /etc/profile umask 077
modify /etc/skel
rm .emacs
rm -r .xemacs
rm .muttrc
rm -r public_html
mkdir Engineers
mkdir Projects
c] For ACL
vi /usr/sbin/useradd.local and insert this line:
setfacl -m g:engineers:5 /home/$1
Go back to /etc/skel and set the default ACL for the Projects dir:
setfacl -d -m g:engineers:5 Projects
d] User ADD
NFS
a] Create Partition
# fdisk /dev/sdaX
# vi /etc/fstab
/dev/sdaX /jobs ext3 rw,bind 0 0
b] Create Directory
#mkdir /jobs/projecta
# chgrp projecta /jobs/projecta
# chmod 770 /jobs/projecta
# chmod 3770 /jobs/projecta
C] Export Directory
# vi /etc/exports
/home 192.168.1.0/24(rw,root_squash,fsid=0)
/jobs/projecta 192.168.1.0/24(rw,root_squash,fsid=0)
# rcnfsserver reload
# insserv nfsserver
d) Server2
# vi /etc/fstab
Server1:/home /home nfs3 rsize=8192,noexec 0 0
server1:/jobs/projecta /jobs/projecta nfs3 rw,noexec 0 0
# mount -a
SAMBA
On Server1:
Create directories /home and /data/engineers exist help= "man smb.conf”
# vi /etc/samba/smb.conf
[global]
workgroup = DA
[homes]
path = /home
browseable = no
create mask = 0600
hostsallow = 192.168.146.0/24 192.168.147.0/24
[data]
path = /data/engineers
browseable = yes
create mask = 0640
hostsallow = 192.168.146.0/24 192.168.147.0/24
# testparm (If no syntax errors, start or restart the samba daemon)
# rcsmb restart
# insserv /etc/init.d/smb
To add the users to the samba server
# smbpasswd -a tbarnes <-- repeat for the other users and type in the password
# chmod 770 /data/engineers
# chgrp engineers /data/engineers
To test from Server2
# smbclient -L //192.168.x.x -U tbarnes <-- get the IP from Server1.
# smbclient //192.168.x.x/data -U tbarnes <-- to open a terminal style interface
# mount -t smbfs //192.168.x.x/data /yourmountpoint -o username=tbarnes
BACKUP Script
#!/bin/bash
# Save the ACL for /home directory
getfacl -R /home > /home/acls 2
if [ ! -d /var/log/backup ] ; then
mkdir /var/log/backup
fi
# Run FULL backup on Thurs and INCREMENTAL on other days
if [ `date +%A` = "Thursday" ] ; then
tar -cf /tmp/backup-full-`date +%F`.tar /home
if test $? -ne 0 ; then
mail -s "Your backup has Failed!!!" root <~
fi
touch /var/log/backup/last-backup
tar -tf /tmp/backup-full-`date +%F`.tar > /var/log/backup/file-list-`date +%F`.log
else
fbdate=`ls -l --time-style=+%F /var/log/backup/last-backup awk '{print $6}'`
find /home -type f -newer /tmp/backup-full-$fbdate.tar
xargs tar -cf /tmp/backup-diff-`date +%F`.tar
if test $? -ne 0 ; then
mail -s "Backup Diff Failure" root <~
fi
tar -tf /tmp/backup-diff-`date +%F`.tar > /var/log/backup/file-list-`date +%F`.log
fi
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment