#!/bin/bash

if [ ! -d /home/$1/.ssh ]
then
   mkdir /home/$1/.ssh
fi
chmod 755 /home/$1/.ssh
g="hmc"
chown root.$g /home/$1/.ssh
if [ ! -f /home/"$1"/.ssh/authorized_keys2 ]
then
  touch /home/"$1"/.ssh/authorized_keys2
  chown "$1"."$g" /home/"$1"/.ssh/authorized_keys2
  chmod 644 /home/"$1"/.ssh/authorized_keys2
fi

cp /opt/hsc/data/ssh/bashrc /home/$1/.bashrc
chmod 555 /home/$1/.bashrc
chown root.root /home/$1/.bashrc
cp /opt/hsc/data/ssh/hmcprofile /home/$1/.bash_profile
chmod 555 /home/$1/.bash_profile
chown root.root /home/$1/.bash_profile
chsh -s /bin/hmcbash $1 >/dev/null 2>&1
exit 0
