Gpg Decryption Error From Only 1 User

Home » CentOS » Gpg Decryption Error From Only 1 User
CentOS No Comments

Hi all,
I am having an issue. We have a vm that has encrypted data with gpg. The vm is CentOS 6.5 and it has multiple users. user1=bob user2=kevin user3= postgres user4=root. Only postgres has access to the file in which we keep the encrypted data. I as root will su – postgres, cd that data dir, and use this command “gpg -d (file_name)” and it works just fine. However the user1 “bob” will sudo su – postgres (have an entry in sudoers file to allow) and become postgres, cd to the dir with the data, run this same command “gpg -d (file_name) however it gives this error

gpg: CAST5 encrypted data can’t connect to `/home/postgres/.gnupg/S.gpg-agent’: No such file or directory gpg-agent[6153]: command get_passphrase failed: Operation cancelled gpg: cancelled by user gpg: encrypted with 1 passphrase gpg: decryption failed: No secret key

I really do not understand whats going on here. I have tried deleting the user bob, and re creating it in case of some sort of corruption but still the same issue. We also see an issue where I installed screen. as any user but bob I can create or join. But as bob I get this error
“Cannot open your terminal ‘/dev/pts/2’ – please check.”Also I, as superuser did this su – bob sudo su – postgres cd data dir gpg -d (file_name)

works with no issues, please help me debug this I am out of ideas.

thanks in advance