1

I found the following related questions on the stackexchange network:

But except for the last one, they are all talking about Windows or Debian and specify software that I've been unable to find for RHEL/CentOS (e.g. msmtp-mta).

The last linked solution seems okay (as in, may possibly work on CentOS) but it requires the password to be entered in cleartext on the command line (in a perl one-liner) to get a base64 encoded string, and then requires the base64 encoded string to be entered later on during a run of openssl. This is relatively insecure as even assuming I've disabled the bash history for that command, the base64 string isn't encrypted and is itself stored in the terminal history, the clipboard and who knows where else. Also, whenever possible I work in a virtual terminal, and thus I would prefer to have a solution which doesn't require copy and paste at all.

I would also prefer to have a solution which would work even in a business environment—i.e. when my email password is entered, it shouldn't even be echoed to the screen (just like a bash login).

So again, the exact question is: How can I safely send an email from a gmail account via the command line on CentOS?

  • Please don't use this or here links, but provide a meaningful phrase for the link. That increases your chance of getting a response. – Marco Oct 15 '15 at 7:58
  • Fixed. They're all on stackexchange; I would never have done that otherwise, but now I realize that there was no way for a reader to determine that before my edit. – Wildcard Oct 15 '15 at 8:44
  • Your edit didn't change a thing, it still shows this links. I edited your question to show you how to insert links the recommended way. – Marco Oct 15 '15 at 8:51
  • Got it now (and I read the articles you linked in your first comment.) – Wildcard Oct 15 '15 at 18:22
1

See this stackoverflow answer on how to install msmtp on CentOS from the Epel repository.

In your ~/.msmtprc config file you can put your cleartext password, or set passwordeval to the name of a command to get your password by whatever means you want.

  • Is there a way to tell it to input the password such that it isn't stored in cleartext or shown in cleartext anywhere? (That's a big part of my original question.) – Wildcard Nov 7 '15 at 7:15
  • As I mentioned, you can set passwordeval to a command that returns the password. The man page gives an example of calling gpg to decrypt a file holding a password. This would require you to setup gpg and give a (different) gpg password to decrypt the file. There are many articles on how to use gpg. – meuh Nov 7 '15 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.