0

i am looking for a way to create a password protected file in Shell with same password instead of random password since we need to ftp the file to 3rd party hence we dont need the password to be changed every time , Below is my sample code snipet ,

echo "STORE,CUSTOMER,START TIME,END TIME" > $dir/output/ORDER.csv
cat $dir/output/ORDER.del >> $dir/output/ORDER.csv
rm -f $dir/output/ORDER.del

I need the file ORDER.csv to be password protected and lets say its 1234 every time.

chimbu
  • 33
  • 1
  • 10

1 Answers1

0

If zipping is an option for you, then you can password protect the zip file:

zip -P 1234 order.zip $dir/output/ORDER.csv
Guru
  • 16,456
  • 2
  • 33
  • 46
  • Thank you, how i can achieve the same in gzip ?. I have noticed only gzip is installed in my server – chimbu Jul 26 '17 at 14:14
  • gzip does not have.. the other option is gpg, but it is a bigger route.. – Guru Jul 26 '17 at 14:22
  • Thank you, i was able to get zip installed in my server and the above solution is working fine as expected, – chimbu Jul 26 '17 at 19:18