#!/bin/sh # Replace 'myuser' with any suitable user; 'mygroup' with any suitable group # These are used in the ACL setup below. username=myuser groupname=mygroup nonexistent_group_id=98765 # A shell script that builds a 'tartest' directory containing a # variety of different types of files to see how different tar # commands handle certain issues. You'll probably need to edit # this script to get it to run on your system (in particular, the # ACL tests below need the name of a valid user and group on your # system). Just delete anything that's not valid on your system. # # After running this script, create a tar archive with something like: # # tar cf tartest.tar tartest # gzip tartest.tar # # Please check the documentation for your tar command to see if there # are options that cause it to archive additional attributes. For # example, SunOS8 tar has "extended" mode, star has a number of # options to enable storage of ACLs, file flags, etc. Please enable # any such options that you find. # # To double-check, unarchive the result into a separate directory and # check what file attributes were actually preserved. You'll probably # need to include special options to get it to restore # permissions/owners, etc. (Many tar commands can't archive links to # files with long names, for example; only a few can archive ACLs or # other extended permissions.) # # Feel free to edit this file to add additional file types or file # permissions or to modify the syntax of particular commands to work # on your particular system. # # Tim Kientzle, May 18, 2004 # (Thanks to David Magda for writing the initial version of this script.) # # P.S. I'm especially interested in any archives that are not correctly # restored by the following command: bsdtar xvpf tartest.tar mkdir tartest cd tartest # some regular files echo "Hello" > file_perm_600 chmod 600 file_perm_600 echo "Goodbye" > file_perm_644 chmod 644 file_perm_644 # some non-regular files mkfifo -m 644 fifo_perm_644 # links ln -s file_perm_644 softlink-to-file_perm_644 ln file_perm_644 hardlink-to-file_perm_644 # Troublesome dir and file permissions mkdir dir_perm_000 touch dir_perm_000/inaccessible_file chmod 000 dir_perm_000 touch unreadable_empty_file chmod 000 unreadable_empty_file echo "Hello" >unreadable_nonempty_file chmod 000 unreadable_nonempty_file # File with 8-bit characters in the name touch abcdefghijklmnopqrstuvwxyz # File with every 8-bit character in the name (except '/', of course) touch "  !\"#$%&'()*+,-.0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~" # long file/directory names # each directory name is 50 characters long, a total of five # nested directories for a total of 250 chracters (not counting /'s) mkdir 012345678901234567890123456789012345678901234567890123456789 mkdir 012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789 mkdir 012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789 mkdir 012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789 mkdir 012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789 # create a 26 letter file in the last directory # so 250+26 = 276 characters touch 012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/abcdefghijklmnopqrstuvwxyz # As above, but with 8-bit characters in the filename touch 012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/bfghjkmqtvwxz # Some more symlinks/hardlinks ln -s 012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/abcdefghijklmnopqrstuvwxyz symlink_to_long_filename ln 012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/012345678901234567890123456789012345678901234567890123456789/abcdefghijklmnopqrstuvwxyz hardlink_to_long_filename # Files/dirs with ACLs echo ACL touch acl-user_${username}-rw- setfacl -m user:${username}:rw- acl-user_${username}-rw- echo ACL2 touch acl-group_${groupname}-rw- setfacl -m group:${groupname}:rw- acl-group_${groupname}-rw- echo ACL3 touch acl-mask_rw- setfacl -m mask:rw- acl-mask_rw- echo ACL4 touch acl-uid-${nonexistent_group_id}-rw- setfacl -m user:${nonexistent_group_id}:rw- acl-uid-${nonexistent_group_id}-rw- echo ACL5 touch acl-mask_r-- setfacl -m mask:r-- acl-mask_r-- echo dir ACL mkdir dir-with-acl setfacl -m user:${username}:rw- dir-with-acl setfacl -d -m user::rwx -m group::rw- -m other::r-- dir-with-acl