Results 1 to 2 of 2
Hello, I am trying to write a script that will create a directory, copy files to it, zip them, move the zip file to the desktop and clean up. However, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-31-2010 #1
- Join Date
- Feb 2009
Root permission for bash script
I wanted to know how to add the permission into the script to allow for access to whoever runs the script to pull the logs, but won't leave the system in the root user?
here is what I have for code so far:
cp /var/logs/* /home/savelogs
zip -r Asset_$host.zip /home/savelogs
cp /home/SeaChange/Asset*.zip /home/SeaChange/Desktop
rm -r /home/savelogs
Any help would be greatly appreciated.
- 08-31-2010 #2
Make sure the user that runs this script has all the permissions needed:
1] +w /home/savelogs
2] +r /var/logs/*
3] +r /home/SeaChange/Asset*.zip
4] +w /home/SeaChange/Desktop
Remark 1: one should NEVER tinker with the home directories of other users.
Remark 2: read the manual pages about the unix file permissions. It is vital for everyone that writes scripts or works within unix environments to understand them.