0

I have a project in which I'm creating users with random passwords for a class of students, and I want to give this list to the teacher so he can distribute the user:pass to each student. What is the best way to do this outside of just saving it in plain text to a .txt file?

Right now it will likely be random alpha-numeric passwords and students cannot login to the shell, and are jailed to their home directory, so the accounts are pretty secure (I think). The accounts will only be used to SFTP web pages to a server.

1 Answer 1

0

One of the most portable ways, if everyone in your organization is using Linux, is to use OpenSSL to encrypt the file.

You can encrypt a file with:

openssl aes-256-cbc -a -salt -in passwords.txt -out passwords.txt.enc

And decrypt it with:

openssl aes-256-cbc -d -a -in passwords.txt.enc -out passwords.txt

Of course you would write a wrapper script for this to make it easier for teachers to do.

You would have to distribute the password over a different channel. Alternatively you could also use GPG and use asynchronous encryption (public/private key):

gpg --output passwords.gpg --encrypt --recipient [email protected]

And decrypt with:

gpg --output passwords.txt --decrypt passwords.gpg

But for this, you would have to set up GPG first, which might be complicated/inconvenient for non-tech savvy users.

1
  • Yeah the teacher has to run all his scripts through the shell so I'll likely do the openssl option. Thanks!
    – dcole617
    Apr 22, 2015 at 15:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .