个人工具

UbuntuHelp:BackupPC/smb

来自Ubuntu中文

跳转至: 导航, 搜索

Introduction

This howto is intended to be a more detailed extension BackupPC howto. This howto will be focused on setting up a "BackupPC server" and windows clients based on the "smb" protcol for Windows Vista

Install

Install BackupPC on your ubuntu linux server/desktop

sudo apt-get install backuppc

You will be asked a few questions: Select your version of `apache` The default for Ubuntu 8.04 is Apache2 Then you will see this message:

Web administration default user created

BackupPC can be managed through its web interface:
http://server1.example.com/backuppc/


For that purpose, a web user named 'backuppc' with 'dAamcQIH' as password has been created. You can change this password by running 'htpasswd /etc/backuppc/htpasswd backuppc'.

Hit enter

Change Password

Please make a note of the web frontend password (dAamcQIH in this case) for the user backuppc. If you don't like the password, you can change it by running

htpasswd /etc/backuppc/htpasswd backuppc

Reconfigure

If you make a mistake with the install you can reconfigure with the following commands Run:

apt-get install libapache2-mod-perl2

Then:

dpkg-reconfigure backuppc

Reset Password

htpasswd /etc/backuppc/htpasswd backuppc

Network

It's assumed that your network has been set up pluged in correctly. To check and find hosts run the following

smbtree -b -N

Don't enter a password, hit enter

WORKGROUP
        \\BACKUP                        backup server (Samba, Ubuntu)
                \\BACKUP\IPC$                   IPC Service (backup server (Samba, Ubuntu))
                \\BACKUP\print$                 Printer Drivers
        \\AMD6000
cli_rpc_pipe_open: cli_nt_create failed on pipe \srvsvc to machine AMD6000.  Error was NT_STATUS_ACCESS_DENIED

Your network will differ, BACKUP is the name of our BackupPC server, AMD6000 is the name of our Windows Vista PC we want to back up. It is advisiable to keep your clients (Hosts) on the same Domain. In this example it is "WORKGROUP" If you can't browse your network at this stage your should correct the error before continuing

Web Connection

Server Setup

At this stage you should be able to connect to you BackupPC server via your web browser. Then open a browser and type in http://192.168.0.51/backuppc/ (or http://server1.example.com/backuppc/)

Login

Afterwards, go to http://192.168.0.51/backuppc/ again and log in with the username backuppc and backuppc's password: smb?action=AttachFile&do=get&target=login.jpg

Home Page

This should take you to the BackupPC home page https://help.ubuntu.com/community/BackupPC/smb?action=AttachFile&do=get&target=HomePageHost.jpg

Add Host

The first thing you need to do is add "Hosts" https://help.ubuntu.com/community/BackupPC/smb?action=AttachFile&do=get&target=host.jpg

  1. Click "add" host
  2. Enter Host Name
  3. Tick DHCP only if required (In most cases it not required. See "BackupPC howto" for details)
  4. Entering a name here is optional (only required for advanced features)

Setup Host

We now need to setup the "Host" config files https://help.ubuntu.com/community/BackupPC/smb?action=AttachFile&do=get&target=HostSetup.jpg Edit Config https://help.ubuntu.com/community/BackupPC/smb?action=AttachFile&do=get&target=EditConfig.jpg https://help.ubuntu.com/community/BackupPC/smb?action=AttachFile&do=get&target=Xfer.jpg

  1. Click "Xfer"
  2. Select "smb"
  3. Windows host (client) share name
  4. Windows host (client) "username"
  5. Windows host (client) "password"

The default setting are set up in the "Main Configuration Editor" Edit Config -->> Xfer If any of the setting are changed from the default make sure the "Override" box is ticked

Host Setup

Windows Vista Security Policy

Check sharing is enabled: Start -->> Control Panel -->> network and sharing center https://help.ubuntu.com/community/BackupPC/smb?action=AttachFile&do=get&target=ShareCenter.jpg I've set my network as "private", Depending on your requirments you may wish to change your network to "public" If you don't want to use passwords uncheck "Password protected sharing"

Windows Vista user passwords

Vista has two methods of setting up username and passwords

Basic

Start -->> Control Panel -->> user Accounts

Advanced

Start -->> Control Panel -->> Administive Tools -->> Computer management -->> Local Users and Groups Entering a username and password using the "basic" interface works, but if you need advanced security policies for yor network you will need to use the "advanced" interface The windows machine(Host) may need setting up. `smbtree` and `smbclient` are exellent tools for checking the host configuration from your backupPC server.

Browse Network

Use the following command:

smbtree -b -U user_name%password

Change `username` and `password` to your own

WORKGROUP
        \\BACKUP
                \\BACKUP\IPC$                   IPC Service (backup server (Samba, Ubuntu))
                \\BACKUP\print$                 Printer Drivers
        \\AMD6000
                \\AMD6000\Public
                \\AMD6000\print$                Printer Drivers
                \\AMD6000\IPC$                  Remote IPC
                \\AMD6000\F$                    Default share
                \\AMD6000\F
                \\AMD6000\D$                    Default share
                \\AMD6000\C$                    Default share
                \\AMD6000\Brother HL-5040       Brother HL-5040
                \\AMD6000\ADMIN$                Remote Admin

Host information

Use the following command:

smbclient //amd6000/f -U user_name%password

Change `username` and `password` to your own

Domain=[AMD6000] OS=[Windows Vista (TM) Ultimate 6001 Service Pack 1] Server=[Windows Vista (TM) Ultimate 6.0]
smb: \>

List files

smb: \>ls

`ls` should display all the files in your directory.e.g.

...
  Untitled Clip 04 23.avi             A 40789522  Sun May 27 19:58:46 2007
  Untitled Clip 04 24.avi             A 43823594  Sun May 27 19:59:01 2007

                40868 blocks of size 8388608. 30050 blocks available
smb: \>

If there is a problem e.g.

smb: \> ls
NT_STATUS_ACCESS_DENIED listing \*

                49999 blocks of size 1048576. 434 blocks available
smb: \>

If you get this error BackupPC will not be able to back up the files in this directory. The problem will be with your windows machine. From your windows machine check that you can browse files from the directory that you want to back up. Enter "q" to quit

Vista Shares

Enable Mapping

  • \\Hostname\C$ Share on Windows Vista

Just about everybody knows about the hidden administrator C$ share that is always built into Windows file sharing, but you might have wondered why you can't use that in Windows Vista. The reason this doesn't work is because of UAC (User Account Control) that Vista is (in)famous for. By default Vista doesn't allow UAC elevation over the network with a local user account. There's a registry key that we can use to change this behavior to work the same as Windows XP. This will make your computer less secure, and I can't recommend that you do this… but it's also good to understand how Windows works.

Manual Registry Hack

Open regedit.exe through the start menu search or run box, and then navigate down to the following key, creating a new key if it doesn't exist.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\LocalAccountTokenFilterPolicy
  • Click start -->> Programs -->> Accessories -->> Command Prompt
  • Right Mouse click -->> Run as Administrator -->> continue
  • Type: regedit
  • Press enter
  • In the left, browse to the following folder:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

  • click a blank area in the right pane
  • Click New
  • Click DWORD Value
  • Type: LocalAccountTokenFilterPolicy
  • Double-click the item you just created
  • Type 1 into the box
  • Click OK
  • Restart your computer

At this point you can map to the C$ share and also perform some other administrative tasks remotely. Note that you will need to enable file sharing in the network and sharing center, and make sure that your firewall settings will allow sharing. With the changes above you can now access hidden c$ shares on Vista machines with the following users

  • Administrator
  • Backup Operators

It is recommended to set up a `user` as a `backup operator` for security reasons

Enable Vista's Administrator Account

The other option to connect to vista C$ ahares is to enable the Administrator Account. This method is a security risk and not recommended but is usefull for fault finding.

  • First you'll need to open a command prompt in administrator mode by right-clicking and choosing "Run as administrator"
  • Now type the following command:

Enable

net user administrator /active:yes

Disable

net user administrator /active:no