Tool

peterhine's picture
tool
Reads:

6074

Score:
0
0
 
Comments:

3

tbackup.sh

(View Disclaimer)

license: 
Free

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"
AttachmentGrootte
tbackup.zip2.7 KB

Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

cpashupathinath's picture

tbackup is not working

Submitted by cpashupathinath on 8 April 2009 - 11:13pm.

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

mpjames's picture

Read the warning message

Submitted by mpjames on 28 July 2009 - 3:06pm.

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.

andreboogaards's picture

Objects with spaces in their names

Submitted by andreboogaards on 9 February 2010 - 12:00am.

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 ' '`

© 2013 Novell