How to switch to LDAP users in shell script and perform events on NFS mount?

Viewed 49

I'm quite new to shell scripting.I have a shell script which has Userslist as Array. User is randomly picked and readwrite operations are performed.

declare -a userNameslist=('user1' 'user2' 'user3' 'user4')
function readAndWriteandDelete{
mount a nfs volume 
switch as user 1 
perform readfiles [as user1]
perform writefiles [as user1]
perform deletefiles [as user1]
}

I tried su -c "touch abc.log" -m user1 but using this only touch command is performed as user1. remaining commands are executed as root user .Please let me know how to perform all events as single user.Any help/pointers would be helpful

0 Answers
Related