Thursday, 15 August 2013

Creating a private folder in home directory of each user

Creating a private folder in home directory of each user

I am trying to create 100 users for a class and so that could write
compile and and run their projects over ssh.
I am assigning default a password say '123' to all users(they could change
it later themselves) I've set soft and hardlimits on disk usage (8mb and
16mb)
Now, I was thinking of creating a private folder in their home folders
which couldn't be read by anyone else Turns out, this script gives 'me'
instead of the user, the read write and execute to all the private folders
Here's what the script looks like.
for i in {1..100}
do
useradd -m -g student $i
mkdir /home/$i/private //Creating a private folder
chmod -R 700 /home/$i/private //
echo "$i:123" | sudo chpasswd
setquota -u $i 9 18 0 0 /
done
Is there anyway I can do this?

No comments:

Post a Comment