SUSE Conversations


tbackup.sh



By: peterhine

April 19, 2007 3:14 am

Reads:273

Comments:5

Rating:0

by peter hine

I noticed that while the rights facility under Linux was useful for telling you the rights for a particular directory, it wasn’t suitable or really useful for anything more. NetWare has trustees.nlm that can backup a volumes trustees to a XML sheet, but Linux doesn’t have that. Simply backing up the
.XML sheet in ._NETWARE directory and copying it back in when needed (or editing it to add particular trustees) only worked occasionally.

I was desiring a tool that would record the current rights in a way that tbackup.exe used to do (when it worked). So here it is.

The ZIP file includes tbackup.sh.

Usage:

tbackup.sh [-f dir] [-r]
Creates a trestore.sh in the root of each volume unless -f is used.
-r relative. Don't include the /media/nss directory.
-f do one directory only, by default program does every volume in /media/nss.

Example output of what trestore.sh would look like:

#!/bin/bash
# Restore rights to volume DATA
rights -f "/media/nss/DATA" -r  irf
rights -f "/media/nss/DATA/apps" -r rf trustee
".CN=Deploy.OU=SubOU.OU=Network.O=Company.T=COMPANY_TREE"

rights -f "/media/nss/DATA/deploy" -r rf trustee
".CN=Deploy.OU=SubOU.OU=Network.O=Company.T=COMPANY_TREE"

rights -f "/media/nss/DATA/user/TestScoundrel" -r rwcefm trustee
".CN=TestScoundrel.OU=OU2.OU=Location.O=Company.T=COMPANY_TREE"
VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)


Categories: Free Tools, Technical Solutions

5 Comments

  1. By:cpashupathinath

    Hi,

    I just tried using tbackup.sh, but throws errors.

    systst-ts-53:~ # sh tbackup.sh
    find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.

    tbackup.sh: line 97: /tmp/t.txt: No such file or directory

    systst-ts-53:~ # sh tbackup.sh -r
    find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.

    tbackup.sh: line 97: /tmp/t.txt: No such file or directory

    systst-ts-53:~ # sh tbackup.sh -r -f
    Internal error !
    systst-ts-53:~ #

    any help is appreciated.

    CP

  2. By:mpjames

    Read the warning message 1st, and let’s do what it says — we’ll need to put the maxdepth option before the type option. Edit tbackup.sh and find line 226
    Change it from:
    for VOL in `find /media/nss -type d -maxdepth 1`; do

    To:
    for VOL in `find /media/nss -maxdepth 1 -type d`; do

    Save your changes and go.

  3. By:andreboogaards

    I inherited a network where some of the groups have spaces in their names. The script as posted chops these off, but with one tiny modification it will handle these correctly:

    Find line 173 in the script:

    USER=`echo "$ULINE"|cut -f 2 -d ' '`

    and add a dash (-) after the 2 to make cut include that field and the rest of the line:

    USER=`echo "$ULINE"|cut -f 2- -d ' '`

  4. By:6567410

    Hi,

    Sorry but my question may look silly, but, here it is.

    I did run tbackup.sh and all is fine.
    It creates a trestore.sh.

    But how do I do the rstore itself?

    I ran trestore.sh with the full path and the message I receive is:
    “error adding trustee:error finding file”

    Any idea?

    Thanks.

Comment

RSS