2014-11-16 15:42:55 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-03-25 16:35:38 +00:00
|
|
|
for type in rsa dsa ecdsa ed25519; do
|
|
|
|
if ! [ -e "/ssh/ssh_host_${type}_key" ]; then
|
|
|
|
echo "/ssh/ssh_host_${type}_key not found, generating..."
|
|
|
|
ssh-keygen -f "/ssh/ssh_host_${type}_key" -N '' -t ${type}
|
|
|
|
fi
|
|
|
|
|
|
|
|
ln -sf "/ssh/ssh_host_${type}_key" "/etc/ssh/ssh_host_${type}_key"
|
|
|
|
done
|
|
|
|
|
2014-11-16 15:42:55 +00:00
|
|
|
if ( id ${USER} ); then
|
2015-06-02 18:55:37 +00:00
|
|
|
echo "INFO: User ${USER} already exists"
|
|
|
|
else
|
|
|
|
echo "INFO: User ${USER} does not exists, we create it"
|
|
|
|
ENC_PASS=$(perl -e 'print crypt($ARGV[0], "password")' ${PASS})
|
|
|
|
useradd -d /data -m -p ${ENC_PASS} -u ${USER_UID} -s /bin/sh ${USER}
|
2014-11-16 15:42:55 +00:00
|
|
|
fi
|
|
|
|
|
2014-11-16 15:56:54 +00:00
|
|
|
exec /usr/sbin/sshd -D
|