diff options
author | Eric Hameleers <alien@slackware.com> | 2010-06-04 21:47:11 +0000 |
---|---|---|
committer | Eric Hameleers <alien@slackware.com> | 2010-06-04 21:47:11 +0000 |
commit | 3198dd42a43d8520d151c8f68064dc3c5e56b398 (patch) | |
tree | 461be6bff81125815bb5e4557e8447a4b6cd7b4a /freenx | |
parent | 403855e05adfb397cdf61e5a61501785594dcc52 (diff) | |
download | asb-3198dd42a43d8520d151c8f68064dc3c5e56b398.tar.gz asb-3198dd42a43d8520d151c8f68064dc3c5e56b398.tar.xz |
This is the version that writes a nice password hash to /etc/shadow
Diffstat (limited to 'freenx')
-rwxr-xr-x | freenx/build/doinst.sh.freenx | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/freenx/build/doinst.sh.freenx b/freenx/build/doinst.sh.freenx index 6f6ec1b4..2a6a31aa 100755 --- a/freenx/build/doinst.sh.freenx +++ b/freenx/build/doinst.sh.freenx @@ -18,6 +18,10 @@ config etc/nxserver/node.conf.new config etc/rc.d/rc.freenx.new config etc/logrotate.d/freenx-server.new +# Dream up a random password hash - it will look like an actual password hash +# in /etc/shadow but in fact no cleartext password will correspond to it: +RANDPW=$(date +%s | md5sum | cut -d' ' -f1 | cut -c1-32) + chroot . <<EOCR 2>/dev/null export \$(grep ^NX_DIR usr/bin/nxloadconfig) export \$(grep ^NX_HOME_DIR usr/bin/nxloadconfig) @@ -49,19 +53,9 @@ if [ ! -e \${NX_ETC_DIR}/users.id_dsa ]; then fi if ! getent passwd | egrep -q "^nx:"; then - # Dream up a random password: - RANDPW=$(date ': date +%s | md5sum | cut -d' ' -f1) - # If we have perl, we make a nice hash for the random password, else we just - # write the md5sum into the password file.. after all, the password for the - # account will never be used (ssh key only): - if which perl >/dev/null 2>&1 ; then - CRYPTPW=$(perl -e 'use strict; print crypt("$RANDPW","\$1\$$RANDPW")."\n";') - else - CRYPTPW="$RANDPW" - fi - # Now, create the 'nx' account: + # Create the 'nx' account: useradd -m -d \${NX_HOME_DIR} -s /usr/bin/nxserver nx - usermod -p "$CRYPTPW" nx 1>/dev/null + usermod -p "\\\$1\\\$$RANDPW" nx 1>/dev/null passwd -u nx 1>/dev/null mkdir -p \${NX_HOME_DIR}/.ssh chmod 700 \${NX_HOME_DIR}/.ssh |