Hi,
Recently i have complain from user that the vnc session failed to create as the lock in /tmp/. The lock created eg: .X0-lock , .X1-lock . Only root can remove the lock.
So i have written a simple script for the user to trigger and remove the lock files.
Code:
#!/bin/sh
cd /tmp
ls -al | grep "\-lock" | awk '{print $9}' > /tmp/flist.txt
for i in `cat /tmp/flist.txt`
do
cd /tmp
rm -rf $i
done
echo "Finish flushing"
It running with root account.
So i visudo and add in the row
Code:
john ALL=NOPASSWD: /usr2/flush.sh
Then i su as john and run the flush script. These are the error message produced:
rm: cannot remove `.X0-lock': Operation not permitted
rm: cannot remove `.X1-lock': Operation not permitted
Please advice and let me know if i did something wrong. Thanks in advance.