Installation of BackupPC on Cent OS 5

Following are the packages to be installed
install httpd

start httpd

via CPAN insaql the following per file

perl-MCPN -e shell

install Compress::Zlib

install Archive::Zip

File::RsyncP

Install the following packages

yum install perl-suidperl

Now we add a user for the backupPC with its group being apache useradd -g apache backuppc

Now we download the backupPC source file

cd /usr/local/src wget http://nchc.dl.sourceforge.net/sourceforge/backuppc/BackupPC-3.1.0.tar.gz

tar -xzvf BackupPC-3.1.0.tar.gz
cd BackupPC-3.1.0
make Makefile.pl
this will be the location of the config file -----------> /etc/BackupPC/config.pl
this will be the locatino where we add host( clients to be backed up ) ---------> /etc/BackupPC/hosts ths is the location where the bin doc lib files are ---------> /usr/local/BackupPC] this is the location where the data will be abcked up -----------> /home/backuppc
this is the location of your cCGI bin directory -----------------> /var/bin/cgi-bin
this the location of the image /var/www/html/backuppc same --------------------------------------> /backuppc

now we will copy the init scritp to the right location

cp /usr/local/src/BackupPC-3.1.0/init.d/linux-backuppc /etc/rc.d/init.d/backuppc
chmod +x /etc/rc.d/init.d/backuppc

(A) Now backing up frm Linux clinet to linux BackupPC

Passwordless login frm linux clinet and from Linux BackupPC server

1. on the Linux BackupPC server
su - backuppc
ssh-keygen -t rsa -------------> this will generate the id_rsa and id_rsa.pub keys in /home/backuppc/.ssh/
once that is done we scp the id_rsa.pb key to the Linux client machine scp ~/.ssh/id_rsa.pub root@linuxclinetIP:/tmp
now we log into the linux clinte Pc and copy the /tmp/id_rsa.pub to ~/.ssh/authorized_keys
cp /tmp/id_rsa.pub ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys

now on the Linux BackupPC server ( su - backuppc ) try to login in ( ssh root@linuxclinet ) , it should log you in without a password You can append as many public keys

2. On the Linux clinet PC
ssh-keygen -t rsa -------------> this will generate the id_rsa and id_rsa.pub keys in /root/.ssh/
once that is done we scp the id_rsa.pb key to the Linux BackupPC server
scp ~/.ssh/id_rsa.pub root@LinuxBackupPCIP:/tmp
now we log into the linux BackupPC server and log in a backuppc user and copy the /tmp/id_rsa.pub to ~/.ssh/authorized_keys
cp /tmp/id_rsa.pub ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys
now on the Linux client PC try to login in ( ssh backuppc@linuxBackupPC IP ) , it should log you in woithout a password
Now, so that we want security to access the cgi script we careate htaccess password file

htpasswd -c /etc/BackupPC/htpasswd client1 ( unix system user ) ---------> enter the password as prompted

now we will add our clinet to the host file located in /etc/BackupPC/hosts

# host dhcp user moreUsers # <--- do not edit this line #farside 0 craig jill,jeff # <--- example static IP host entry #larson 1 bill # <--- example DHCP host entry 192.168.0.244 0 linuxclient1 # <--- where only linuxclinet1 user can acces this system back up frm webinterfce 192.168.0.209 0 backuppc # <--- where only backuppc user can acces this system back up frm webinterfce

we will create/edit a congif file in /etc/BackupPC/pc/linuxclientPCIP.pl

$Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l root $hostIP $rsyncPath $argList+'; $Conf{RsyncClientCmd} = '$sshPath -q -x -l root $hostIP $rsyncPath $argList+'; $Conf{XferMethod} = 'rsync'; $Conf{RsyncShareName} = ['/home','/var/log']; now we will edit he httpd.conf so that only the prticulat user assigned to the particular clinet gets access to the cgi script

<Directory "/var/www/cgi-bin"> # AllowOverride None # Options None # Order allow,deny # Allow from all Options ExecCGI FollowSymlinks AddHandler cgi-script .cgi DirectoryIndex index.cgi AuthGroupFile /etc/backuppc/htgroup AuthUserFile /etc/backuppc/htpasswd AuthType basic AuthName "backuppc" require valid-user

</Directory>

now we restart httpd and backuppc

/etc/init.d/httd restart /etc/init.d/backuppc restart

now we will try to take a back up of the of the Linux clinet Pc

add the user name and password .... this should gvive u access to the particular clinet

(B) Now backing up frm Windows clinet to linux BackupPC

we unzip it in C:/rsyncd/
we edit the rsyncd.conf file
use chroot = false
max connections = 4
pid file = c:/rsyncd/rsyncd.pid
lock file = c:/rsyncd/rsyncd.lock

#this is frm where all your data will be backed up.

[cDrive0] path = c:/rsyncd comment = agnello's documents auth users = agnello secrets file = c:/rsyncd/rsyncd.secrets # hosts allow = 172.16.0.17 strict modes = false read only = false list = false

[cDrive1] path = c:/var comment = agnello's documents auth users = agnello secrets file = c:/rsyncd/rsyncd.secrets # hosts allow = 172.16.0.17 strict modes = false read only = false list = false

[cDrive2] path = c:/Documents and Settings/All Users/Documents/My Music comment = agnello's documents auth users = agnello secrets file = c:/rsyncd/rsyncd.secrets # hosts allow = 172.16.0.17 strict modes = false read only = false list = false

Now save the file and run the service.bat file make sure that your windows PC has not blocked 873

Now edit the rsync.secret add the following lines

agnello:agnello123

now on the Linux BackuPC server we create a config file for the windows client

eg : vi /etc/BackupPC/pc/windowsclentip.pl $Conf{XferMethod} = 'rsyncd'; $Conf{RsyncdUserName} = 'agnello'; $Conf{RsyncdPasswd} = 'agnello123'; $Conf{RsyncShareName} = ['cDrive0','cDrive1','cDrive2']; $Conf{ClientCharset} = 'cp1252'

maker sure that the user and password is tha same as rsync.secret file

now we will add our windows clinet to the host file located in /etc/BackupPC/hosts on the lINUX bACKUPpc SERVER

# host dhcp user moreUsers # <--- do not edit this line #farside 0 craig jill,jeff # <--- example static IP host entry #larson 1 bill # <--- example DHCP host entry 192.168.0.244 0 linuxclient1 # <--- where only linuxclinet1 user can acces this system back up frm webinterfce 192.168.0.209 0 winclient1 # <--- where only backuppc user can acces this system back up frm webinterfce

now we restart backuppc

/etc/init.d/backuppc restart

now try browser in the the http://linuxBackupPCserverIP/cgi-bin/backupc

add the user name and password .... this should gvive u access to the particular clinet ( ref /etc/BackupPC/hosts file )

Now take your regular backups
--

installing pure ftpd with mysql virtual users & unix users

mysql virtual users with unix users

Now in case we need to store the password of the user in the mysql database then we need to add the following steps

step 1: we copy the pureftpd-mysql.conf from /usr/local/src/pureftpd-msql.conf ====> to /usr/local/pureftpd/etc/.

the pureftpd-mysql.conf has the following details: 


#MYSQLServer     localhost
#MYSQLPort       3306
MYSQLSocket     /tmp/mysql.sock
MYSQLUser       root
MYSQLPassword   agnello
MYSQLDatabase   pureftpd
MYSQLCrypt      MD5
MYSQLGetPW      SELECT Password FROM ftpd WHERE User="\L"
MYSQLGetUID     SELECT Uid FROM ftpd WHERE User="\L"
MYSQLGetGID     SELECT Gid FROM ftpd WHERE User="\L"
MYSQLGetDir     SELECT Dir FROM ftpd WHERE User="\L"

step 2 : we create a data base in mysql ( pureftpd )

mysql -u root -password

create database pureftpd;

use pureftpd;

CREATE TABLE ftpd (
  User VARCHAR(16) BINARY NOT NULL,
  Password VARCHAR(64) BINARY NOT NULL,
  Uid VARCHAR(11) NOT NULL default '-1',
  Gid VARCHAR(11) NOT NULL default '-1',
  Dir VARCHAR(128) BINARY NOT NULL,
  PRIMARY KEY  (User)
);

quit;

step 3: we create a directory where all our domains will be stored say  /etc/website
        the permission  i wll be as follows ( these are just the basic )


       [root@linux-test pure-ftpd-1.0.21]# ll /home/
       drwxr-xr-x 5 root     root     4096 May 20 17:30 website

step 4 : now suppose we have to creat a user for a domain called silly .com

         1. lets create a unix user

         useradd -d /home/website/silly.com -s /sbin/nologin silly

         2. then we add the virtual user ( with password ) in the the mysql database ( usning phpmyadmin )

         user: silly
         password ( MD5 ): silly123
         uid : silly
         gid : sil ly
         dir: /home/website/silly.com     
 
step 5: now we start the ftpd daemon

/usr/local/pureftpd/sbin/pure-ftpd   -lmysql:/usr/local/pureftpd/etc/pureftpd-mysql.conf -l unix  -j /home/websites &

can view the log with tail -f /var/log/messages

now try to log in ftp://192.168.0.244 with username and password

--

installation of Pure FTPD with virtual user and system user

Installation of pureftpd
 
cd  /usr/local/src
 

./configure --prefix /usr/local/pureftpd  --with-mysql=/usr/local/mysql --with-quotas --with-altlog=/var/log/pureftpd --with-puredb

make  && make install

###################################################################

we have enable virtual user , this means that we can have 1000 of users with out having the /etc/passwd fle touched . So  create a system user.


mkdir /usr/local/pureftpd/etc
touch  /usr/local/pureftpd/etc/pureftpd.passwd

####################################################################

now lets the create the a user

step 1 : creat a unix user

useradd -d /home/website/nokia.com -s /sbin/nologin nokia


step 2: now to add a  ftp user ( the passwor of this suer will be in a seperate file )

/usr/local/pureftpd/bin/pure-pw useradd nokia -f /usr/local/pureftpd/etc/pureftpd.passwd  -u nokia -d /home/website/nokia.com -m


step 3: now to start the pureftpd daemond

/usr/local/pureftpd/sbin/pure-ftpd   -l puredb:/usr/local/pureftpd/etc/pureftpd.pdb -j /home/websites &


---------------
few extra tips
---------------
...bin/pure-pw passwd nokia -f /usr/local/pureftpd/etc/pureftpd.passwd  ---> this will change password for nokia !!

...bin/pure-pw list -f /usr/local/pureftpd/etc/pureftpd.passwd ----> this will list all the ftp-users


The  logging  facaility is done in the  /etc/syslog.conf add the folloing ftp.*    /var/log/pureftpd

################################################################



--

set correct time stamp for mails on postfix mailserver

The problem is that Postfix doesn't know what timezone you are in.
It's compounded by the fact that Postfix, for security reasons,
doesn't want to read things outside of it's directory. However you can
fix this by copying the timezone files to a directory in
/var/spool/postfix/

cd /var/spool/postfix/
sudo mkdir etc

now, take a look at /etc/localtime:

ls -la /etc/localtime
lrwxr-xr-x 1 root wheel 36 6 Aug 20:05 /etc/localtime ->
/usr/share/zoneinfo/America/New_York

copy /usr/share/zoneinfo/country/state to /var/spool/postfix/etc/

sudo cp -p /usr/share/zoneinfo/America/New_York \
/var/spool/postfix/etc/localtime

postfix check
postfix reload

Now take a look at your mail.log and see if all the times line up.


--

Other Articles

Enter your email address: