Jump to content


Photo

How to allow Normal Linux User to run particulare bash / shell script


  • Please log in to reply
2 replies to this topic

#1 php-pandit

php-pandit
  • New Members
  • Pip
  • Newbie
  • 3 posts
  • LocationBhuigaon, Vasai, Mumbai, Maharashtra, India

Posted 26 August 2006 - 06:46 AM

Hi

Plz, help me out i want to allow one of my linux user to run this below bash script to take mysql database backup.

Shell Script:

<!---------------- ##################### ----------------------->

#!/bin/bash
TIMESTAMP=`date +%m-%d-%y-%H%M`

cd /home/backups/mysql

find /home/backups/mysql/*.tar.gz -mtime +7 -exec rm -f {} ;


# my database
DBNAME=my_database
mysqldump --opt -c -e -Q -u MYSQL_USER -p'MYSQL_PASSWORD' $DBNAME > $DBNAME.sql
tar czpf $DBNAME.$TIMESTAMP.tar.gz $DBNAME.sql
rm -f $DBNAME.sql

<!---------------- ##################### ----------------------->

But when i am running this script as a normal user it is giveing me an  error of "Permission denied"

Thanks
Harshad Pandit
alias(PHP Pandit)
<a href="http://php-pandit.bl...t.com/">Harshad Pandit's Blog</a>
Thanks,
Harshad Pandit
Software Devloper,
Email: php.pandit@gmail.com

#2 steelmanronald06

steelmanronald06
  • Staff Alumni
  • Advanced Member
  • 2,004 posts
  • LocationOk

Posted 28 August 2006 - 12:43 PM

Gotta make that user part of the mysql group ;)

#3 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 28 August 2006 - 05:46 PM

You just need to give it executable permissions (or whatever you'd call it).

chmod +x your_script.sh





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users