gpg: cannot open ‘/dev/tty’: No such device or address error while encrypting/decrypting using PGP keys


You get the following error while trying to use the encrypt post-process command or the decrypt pre-process command.

gpg: cannot open '/dev/tty': No such device or address


This error happens because the system tries to output to /dev/tty which either does not exists in the file system, or the neolane user does not has rights of this directory. In order to fix it, we need to by-pass this step. In the GPG command, add --no-tty to skip this step. For eg:


preProcessCommand command=“gpg --decrypt –no-tty --recipient ******** “$fileName”” label=“Decryption GPG” name=“GPGdecrypt”/
     postProcessCommand command=“gpg --encrypt –no-tty --recipient ******* “$fileName”” label=“Encryption GPG” name=“GPGencrypt” suffix=“gpg”/


Also plesae check if  --passphrase passphrase in preProcessCommand is present or not . If passphrase is missing then also we can get this error

        preProcessCommand name="GPGdecrypt" label ="Decryption GPG" command="gpg --decrypt --passphrase passphrase --recipient "$fileName""/
        postProcessCommand name="GPGencrypt" label ="Encryption GPG" command="gpg --encrypt --recipient "$fileName"" suffix="gpg"/

On this page