From e81c710f30ec21c1cfb800a7afb66154672b28f5 Mon Sep 17 00:00:00 2001 From: guanghongwei Date: Thu, 21 Aug 2014 17:49:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=87=EE=86=BD=E6=95=BC=E5=A8=A3=E8=AF=B2?= =?UTF-8?q?=E5=A7=9Esudo=E9=8F=83=E5=89=81=E6=AE=91=E7=81=8F=E5=BB=B1ug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sudo.ldif | 2 +- sudoadd.sh | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sudo.ldif b/sudo.ldif index bb59aa10a..c18f678aa 100644 --- a/sudo.ldif +++ b/sudo.ldif @@ -1,4 +1,4 @@ -dn: cn=guanghongwei,ou=Sudoers,dc=yolu,dc=com +dn: cn=guanghongwei,ou=Sudoers,dc=dianping,dc=com objectClass: top objectClass: sudoRole cn: guanghongwei diff --git a/sudoadd.sh b/sudoadd.sh index 190d0d952..ce48f1956 100644 --- a/sudoadd.sh +++ b/sudoadd.sh @@ -12,7 +12,7 @@ dir=$(cwd) sudo_file=${dir}/sudo.ldif -user_sudo_file=${dir}/sudouser.ldif +user_sudo_file=${dir}/${username}.ldif if [ -z $1 ];then echo @@ -27,6 +27,10 @@ if [ $? != '0' ];then exit 3 fi +sed -i "/guanghongwei/ s@dianping@$domain@g" ${sudo_file} +sed -i "/guanghongwei/ s@com@$suffix@g" ${sudo_file} sed -e "s@guanghongwei@$username@g" ${sudo_file} > $user_sudo_file -ldapadd -x -h ${host} -w ${ldapassword} -D "cn=admin,dc=$domain,dc=$suffix" -f $user_sudo_file \ No newline at end of file + +ldapadd -x -h ${host} -w ${ldapassword} -D "cn=admin,dc=$domain,dc=$suffix" -f $user_sudo_file +rm -f $user_sudo_file \ No newline at end of file