Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Exporting the password into a environment variable is not a good idea. A password shouldn't be in a script or passed to an environment variable. Commented May 25, 2021 at 10:18
  • I understand, but this is a single-user device that is encrypted. Commented May 26, 2021 at 22:17
  • Then why run commands as another user? And how does it benefit you in any way to put the user's password in a script? When running the script as root, you don't need the user's password, therefore you can avoid the horrible practice of putting a password in a script. Commented May 26, 2021 at 23:32
  • The reason it doesn't run as root is because the file-set it's working on isn't owned by root. The files are put there over ssh as a different user. It still needs the password because it's a backup-set which is password encrypted and runs to a schedule. Commented May 28, 2021 at 8:08