backup in tape with a password

dear experts,
usually when i backup to my tape drive i use

tar cv [directory]

now is there a way to add a password to that tape drive i cant use hardware encryption because we are using LTO3.
another question if i would like to add a compression to the backup directory while backing up how can i do that?

it seems tar cannot encrypt files. you can use gpg, or perhaps 7z or rar together with tar.
its a good idea to add 'real' archiver anyway, to shrink the backup. (even though tape might compress it in hardware)

so what do u recommend to install gpg or 7z?

---------- Post updated at 01:15 AM ---------- Previous update was at 12:58 AM ----------

yeah and i just install p7zip in my server now could you please tell me the right syntax to do this ?

something like this should work:
tar cf - directory | 7za a -p -si directory.tar.7z

check if its AES-256
( 7zip in Solaris | Unixpin )

edit: um, I don't know if 7z can send backup directly to tape. perhaps you could simply copy the resulting file to tape.
another option that might help is this: -so Write data to StdOut (eg: 7z x -so directory.tar.7z | tar xf -)

edit2: check this out: http://www.shell-fu.org/lister.php?id=44

great thanks for the help :slight_smile: i am trying it now will update you with the result.

the last option: ( [shell-fu:view-44]$ )
seems most elegant, hope you make it work. just be sure it preserves all permissions and stuff.