[Samba-it] Autocreazione delle home...

Marco Gaiarin gaio at sv.lnf.it
Tue May 2 18:07:01 MDT 2006


Siccome monto le home via nfs tra una serie di macchine, gli script di
creazione degli utenti mi fallivano perchè magari tentavano di creare
la home dove andava invece montata via nfs.

Allora ho preferito, nel server che ha le come, aggiungere un root
preexec ad uno script di creazione.

Lo script era una porcata, ma recentemente mi è servito rimetterci mano
per aggiungere la possibilità di creare le home per un dominio in trust
con il corrente, ovvero utenti del tipo DOMINIO\user.

Ho modificato lo script come da allegato, ma non va. O meglio, va
perfettamente se lo eseguo a manina, non funziona manco morto da samba.


Dove sbaglio, e come posso debuggare la cosa?

-- 
dott. Marco Gaiarin				    GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''                http://www.sv.lnf.it/
  Polo FVG  -  Via della Bontà, 7 - 33078  -  San Vito al Tagliamento (PN)
  marco.gaiarin(at)sv.lnf.it	  tel +39-0434-842711  fax +39-0434-842797
-------------- next part --------------
#!/bin/sh
#
#   script that (auto) create home for a samba user
#   Copyright (C) 2005  Marco Gaiarin (gaio at linux.it)
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
# 
# CHANGELOG
#
# 1.0.0 (Mon Oct 10 12:11:20 CEST 2005)
#  + first public release
# 1.1.0 (Tue Apr  4 11:15:55 CEST 2006)
#  + added support for trust accounts (DOMAIN\user)

# some vars...
#
SKEL="/etc/skel"			# skel for homedir
GROUP="users"				# defaut group for homes
PROTO="gaio"				# quota user prototype
MODE="700"
USER=$1


# Check if user really exist...
#
info=$(getent passwd ${USER})
if [ -z "${info}" ]; then
	exit 1
fi

# Getting home...
#
home=$(echo "${info}" | cut -d : -f 6)

# Checking if users just have their home...
#
if [ -d ${home} ]; then
	exit 0
fi


# OK, do the job.
#
cp -a ${SKEL} ${home}
chmod ${MODE} ${home}
chown -R ${USER}.${GROUP} ${home}
if [ -n ${PROTO} ]; then
	edquota -p ${PROTO} ${USER}
fi


# all done, exit
#
exit 0


More information about the samba-it mailing list