Results 1 to 2 of 2
I need to create a tar file of all of the authorized_keys files in a directory and / or it's subdirectories.
I have this:
find /chroot/home/ -type f -name authorized_keys
...
- 08-29-2011 #1Just Joined!
- Join Date
- Jul 2010
- Posts
- 15
Tar of authorized_keys in unknown directories script
I need to create a tar file of all of the authorized_keys files in a directory and / or it's subdirectories.
I have this:
find /chroot/home/ -type f -name authorized_keys
How can I create a tar file of whatever it finds? I need to do it automatically so that I can have a cron job that backs up all of the authorized_keys into a folder.
Actually need the directory path too, like:
/chroot/home/mrjohn/.ssh/authorized_keys
That way I could restore it if needed.
- 08-30-2011 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
just throw the tar command in front of your find command, and put the find command in backticks, e.g.:
It will save the full path (less the beginning '/') in the tarball.Code:tar -cf /tmp/mykeys.tar `find /chroot/home/ -type f -name authorized_keys`


Reply With Quote