UoM::RCS::Talby::URS

Doc Group

Authentication and authorisation:

How-Tos:

SSH:

Fuse and SSHFS:

Adding New Users

Example:

  root@sekhmet> /home/simonh/sbin/newuser.bash mpciish2

The newuser.bash Script:

#!/bin/bash


#
# -- get uid from ldap
#
uid=`ldapsearch -x -h ldap.manchester.ac.uk "cn=$1" | grep uidNumber | awk '{print $2}'`
echo "Gonna use UID: $uid"

#
# -- get gid from ldap
#
gid=`ldapsearch -x -h ldap.manchester.ac.uk "cn=$1" | grep gidNumber | awk '{print $2}'`
echo "Gonna use GID: $gid"


#
# -- useradd
#
echo "useradd -u $uid -g $gid -s /bin/bash $1"
useradd -u $uid -g $gid -s /bin/bash $1


#
# -- mkdir home dir
#
echo "mkdir /home/$1"
mkdir /home/$1
#
echo "chown $1 /home/$1"
chown $1 /home/$1
chgrp $gid /home/$1


#
# -- add to fuse group
#
echo "usermod -a -G fuse $i"
usermod -a -G fuse $1