LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-18-2012, 09:34 PM   #16
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879

If I haven't overlooked anything major:
Code:
while read filePath #Read file paths from file
do 
	if [ -e "$filePath" ] #If file path exists
	then
		fileName=${filePath##*/} #Variable contains file name from last field
		openssl enc -aes-256-cbc -salt -in $filePath -out /home/backup/$fileName.enc -pass pass:Anonymous 2>/dev/null 1>>~/enc.log #Encrypt file, save output to backup directory, and suppress errors
		# checksumList=$(echo "$checksumList " $(sha256sum $filePath 2>/dev/null)) #Variable contains checksums of files
                sha256sum $filePath 2>/dev/null
	else
		echo -e "ERROR: File \"$filePath\" does not exist." #Error
                exit 5
	fi
done < "/root/CONFIGS" | openssl enc -aes-256-cbc -salt -out EncryptedChecksums.enc -pass pass:Anonymous
 
1 members found this post helpful.
Old 04-18-2012, 09:59 PM   #17
drandre
LQ Newbie
 
Registered: Apr 2012
Distribution: OpenSUSE 12.1
Posts: 11

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Tinkster View Post
If I haven't overlooked anything major:
Code:
while read filePath #Read file paths from file
do 
	if [ -e "$filePath" ] #If file path exists
	then
		fileName=${filePath##*/} #Variable contains file name from last field
		openssl enc -aes-256-cbc -salt -in $filePath -out /home/backup/$fileName.enc -pass pass:Anonymous 2>/dev/null 1>>~/enc.log #Encrypt file, save output to backup directory, and suppress errors
		# checksumList=$(echo "$checksumList " $(sha256sum $filePath 2>/dev/null)) #Variable contains checksums of files
                sha256sum $filePath 2>/dev/null
	else
		echo -e "ERROR: File \"$filePath\" does not exist." #Error
                exit 5
	fi
done < "/root/CONFIGS" | openssl enc -aes-256-cbc -salt -out EncryptedChecksums.enc -pass pass:Anonymous
Problem solved! (again)

Is there anything that Linux gurus can't do?

Thank you, again!
 
Old 04-18-2012, 10:54 PM   #18
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
Sweet, and welcome.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sed - use sed to replace multiple instances from "x" to "y" in a line mrodmac Linux - General 4 02-02-2010 11:37 AM
printing hh in hh:mm using "awk '{FS=":";print $1}'" misses first line of output!! mayankmehta83 Linux - Newbie 2 12-03-2009 02:55 AM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM
No UTMPX entry, You must EXEC "login" for the lowest "shell" ooihc Solaris / OpenSolaris 7 03-12-2007 02:09 PM
Replacing "function(x)" with "x" using sed/awk/smth Griffon26 Linux - General 3 11-22-2006 10:47 AM


All times are GMT -5. The time now is 03:36 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration