Results 1 to 2 of 2
Thread: Root permission for bash script
|
Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
-
08-31-2010 #1
- Join Date
- Feb 2009
- Posts
- 8
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:
#!/bin/bash
host= 'hostname'
mkdir /home/savelogs
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.