Shell Script for making directories from a file name
Hello guys
I have a file with usersnames in the following format user1 user2 user3 i want to make directories of all using shell script. and then giving them required permissions. my users are on other LDAP server and i have binded ldap using pam mechanism. please help, i am complete newbie in shell scripting. Thanks in advance |
If you're new to scripting you might want some Bash scripting guides like http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html or http://www.tldp.org/LDP/Bash-Beginne...tml/index.html and later on the http://www.tldp.org/LDP/abs/html/.
|
for beginner in `cat usernames`; do mkdir $beginner chmod 640 $beginner; done
|
Quote:
|
for beginner in `cat usermanes`; do mkdir $beginner; chmod 640 $beginner; done
Now it's correct :) |
Quote:
|
I got all my users of ldap from this.. to a file
#getent passwd > ldap redirected name and gid value of users in another file with ':' as a delimeter #gawk -F: '{ print $1,":"$4 }' ldap > arpit now the script.... #!/bin/bash NEW_USERS="/root/arpit" cat ${NEW_USERS} | \ while read USER GID do mkdir /home/${USER} chown ${USER}${GID} /home/${USER} cp -f /etc/skel/.* /home/${USER}/ done after that i tried to set user quota to my users.. but didnt worked.. can someone help me with it after setting quota on one user i tried this.. but didnt worked edquota -p user1 `awk -F: {print $1}' /root/arpit' please help |
Quote:
Code:
edquota -p user1 `awk -F: '{print $1}'` Code:
edquota -p user1 $(awk -F: '{print $1}') |
All times are GMT -5. The time now is 02:01 PM. |