Difference between revisions of "BackupPC"

From Stadm
Jump to navigationJump to search
(Created page with "=Windows= *We have made some scripts to make the install go a little quicker and painless *First we have a .bat file(runs through windows command prompt) to add a user for bac...")
 
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Category:Windows]]
 
=Windows=
 
=Windows=
 
*We have made some scripts to make the install go a little quicker and painless
 
*We have made some scripts to make the install go a little quicker and painless
 
*First we have a .bat file(runs through windows command prompt) to add a user for backuppc to use
 
*First we have a .bat file(runs through windows command prompt) to add a user for backuppc to use
 
*I have included and annotated the code to help understand what the script does, the actual script echos warnings and informs you of what it is doing along the way
 
*I have included and annotated the code to help understand what the script does, the actual script echos warnings and informs you of what it is doing along the way
  net user /add root :#This adds a user named root
+
*THE .BAT SCRIPT MUST BE RUN IN AN '''ADMINISTRATIVE COMMAND PROMPT''', will fail if command prompt is not "Run as Administrator"
  net localgroup administrators root /add
+
  net user /add root     #This adds a user named root
  net share sharename=C:\ /grant:root,full
+
  net localgroup administrators root /add     #adds the user root to the Administrator group
 +
  net share sharename=C:\ /grant:root,full     #gives the user the permission to backup all files on the C:\ drive
 +
 +
net user root *    #Takes a password from stdin(prompt) to set for the user root
 +
 +
netsh advfirewall firewall add rule name="SSH-Hole Port 22" dir=in action=allow protocol=TCP localport=22 remoteip=128.111.100.0/24,128.111.101.0/24 profile=domain,private,public
 +
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow remoteip=128.111.100.0/24,128.111.101.0/24 profile=domain,private,public
 +
[[File:cmd1.PNG|600px|Commands Ran]]
 +
 
 +
(NOTE to self: Small typo in net share sharename, put ":" instead of "=", corrected right after)
 +
 
 +
*You must have Cygwin installed to run the following commands
 +
 
 +
*Log in as root
 +
*Be sure to run the Cygwin Terminal as an Administrator
 +
*Now that the root user is created logout of the current account and log back in as the root user, we will run a bash script to setup ssh
 +
mkpasswd -l > /etc/passwd    #Create passwd file
 +
mkgroup -l > /etc/group    #Create group file
 +
 
 +
ssh-host-config    #Configure ssh on host to accept incoming connections, select all the defaults
 +
 
 +
net start sshd    #start the sshd service on boot
 +
[[File:cygwin1.PNG|600px|Commands Ran]]
 +
[[File:cygwin2.PNG|600px|More Commands Ran]]
 +
*Once this script has ran exit the cygwin terminal and open a new one(looking for a way around this still)
 +
*run the following command:
 +
ssh-user-config
 +
[[File:cygwin3.PNG|600px|More Commands Ran]]
 +
*You should now have ssh access to the machine
 +
 
 +
=BackupPC Side=
 +
*BackupPC has the defaults in place to backup linux and Mac machines, the rsync locations must be changed on server
 +
*log into your backuppc account at either ashes or twe
 +
*select the host you wish to edit amd click "Edit Config" under the hostname
 +
*Select the Xfer tab
 +
*You will override the following values, delete the entries that appear under these categories:
 +
*Rsyncsharename
 +
/cygdrive/c
 +
*BackupFilesExclude:
 +
/cygdrive/c/pagefile.sys
 +
/cygdrive/c/hiberfil.sys
 +
*RsyncArgsExtra:
 +
--exclude=/cygdrive/c/System\ Volume\ Information/
 +
--exclude=/cygdrive/c/Windows/
 +
--exclude=/cygdrive/c/Program\ Files/
 +
--exclude=/cygdrive/c/Program\ Files\ \(x86\)/
 +
--exclude=/cygdrive/c/ProgramData/
 +
*Click save once you have modified these values. If not done so already, start a full backup
 +
 
 +
 
 +
==README==
 +
*You may run the add_Root_ssh.bat before or after installing cygwin, it will create a root user and add appropriate privileges and the prop SSH-HOLE
 +
*NOTE: Script runs through Windows Command Prompt(NOT POWERSHELL) and must be "Run as Administrator", will fail if not run as Administrator
 +
*After installing cygwin, change accounts so that you are the newly created user Root
 +
*Navigate or copy over ssh_setup to a directory you can execute from and run the script, it will ask you questions accept the defaults
 +
*After the script has finished running, exit the cygwin prompt and open another again(reinitializes home directory with proper permissions)
 +
*run command
 +
ssh-user-config
 +
*you can now ssh into the machine as root

Latest revision as of 12:37, 14 July 2015

Windows

  • We have made some scripts to make the install go a little quicker and painless
  • First we have a .bat file(runs through windows command prompt) to add a user for backuppc to use
  • I have included and annotated the code to help understand what the script does, the actual script echos warnings and informs you of what it is doing along the way
  • THE .BAT SCRIPT MUST BE RUN IN AN ADMINISTRATIVE COMMAND PROMPT, will fail if command prompt is not "Run as Administrator"
net user /add root     #This adds a user named root
net localgroup administrators root /add     #adds the user root to the Administrator group 
net share sharename=C:\ /grant:root,full     #gives the user the permission to backup all files on the C:\ drive

net user root *     #Takes a password from stdin(prompt) to set for the user root

netsh advfirewall firewall add rule name="SSH-Hole Port 22" dir=in action=allow protocol=TCP localport=22 remoteip=128.111.100.0/24,128.111.101.0/24 profile=domain,private,public
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow remoteip=128.111.100.0/24,128.111.101.0/24 profile=domain,private,public

Commands Ran

(NOTE to self: Small typo in net share sharename, put ":" instead of "=", corrected right after)

  • You must have Cygwin installed to run the following commands
*Log in as root 
  • Be sure to run the Cygwin Terminal as an Administrator
  • Now that the root user is created logout of the current account and log back in as the root user, we will run a bash script to setup ssh
mkpasswd -l > /etc/passwd     #Create passwd file
mkgroup -l > /etc/group     #Create group file
ssh-host-config     #Configure ssh on host to accept incoming connections, select all the defaults
net start sshd     #start the sshd service on boot

Commands Ran More Commands Ran

  • Once this script has ran exit the cygwin terminal and open a new one(looking for a way around this still)
  • run the following command:
ssh-user-config

More Commands Ran

  • You should now have ssh access to the machine

BackupPC Side

  • BackupPC has the defaults in place to backup linux and Mac machines, the rsync locations must be changed on server
  • log into your backuppc account at either ashes or twe
  • select the host you wish to edit amd click "Edit Config" under the hostname
  • Select the Xfer tab
  • You will override the following values, delete the entries that appear under these categories:
  • Rsyncsharename
/cygdrive/c
  • BackupFilesExclude:
/cygdrive/c/pagefile.sys
/cygdrive/c/hiberfil.sys
  • RsyncArgsExtra:
--exclude=/cygdrive/c/System\ Volume\ Information/
--exclude=/cygdrive/c/Windows/
--exclude=/cygdrive/c/Program\ Files/
--exclude=/cygdrive/c/Program\ Files\ \(x86\)/
--exclude=/cygdrive/c/ProgramData/
  • Click save once you have modified these values. If not done so already, start a full backup


README

  • You may run the add_Root_ssh.bat before or after installing cygwin, it will create a root user and add appropriate privileges and the prop SSH-HOLE
  • NOTE: Script runs through Windows Command Prompt(NOT POWERSHELL) and must be "Run as Administrator", will fail if not run as Administrator
  • After installing cygwin, change accounts so that you are the newly created user Root
  • Navigate or copy over ssh_setup to a directory you can execute from and run the script, it will ask you questions accept the defaults
  • After the script has finished running, exit the cygwin prompt and open another again(reinitializes home directory with proper permissions)
  • run command
ssh-user-config
  • you can now ssh into the machine as root