Quote:
Originally Posted by berndbausch
Code:
ln -s /test /home/new_user/Desktop
chown new_user:new_user /home/new_user/Desktop
|
My advice is not quite correct and, it seems, needs to be more detailed, so let me amend it.
Before writing a script, you need to test the approach. For example:
- Create two users, let's call them user1 and user2. I assume that their Desktop directories are /home/user1/Desktop and /home/user2/Desktop.
- Create a group for all those users that are supposed to access the shared directory. Let's call it common.
- Add that group to the new users. On the command line, this is done as follows:
Code:
usermod -a -G common user1
usermod -a -G common user2
- Ensure that the /test directory can be accessed and written by members of group common. One way to do that is
Code:
chgrp common /test
chmod g+rwx /test
- Link /test to the users' Desktop directory
Code:
ln -s /test /home/user1/Desktop
Now log on as
user1 and
user2 and test if they can use the folder in the intended way.
Once you are satisfied it all works, run a script like this each time you create a new user:
Code:
usermod -a -G common $1
ln -s /test /home/$1/Desktop
Let's call the script "
setuptest". The
$1 is a command line argument. For each user that requires /test to be on the Desktop, run "
setuptest nameoftheuser". You can do that in a loop:
Code:
for u in anne bob chris daniel erika fshah
do
setuptest $u
done