LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 02-08-2005, 02:49 PM   #1
agreenb
LQ Newbie
 
Registered: Feb 2005
Posts: 2

Rep: Reputation: 0
running scripts from vfat mounted drives


Ok, so I've just put together a dual-boot machine with WinXP and RedHat 9. I've got 3 drives with several partitions on one of them. I've formatted 3 large data partitions as FAT32 so that they can be accessed through both Win and Linux. I've added the mounting info. to my /etc/fstab (see below) and I'm able to read/write to the data partitions as I had intended, so far so good. Now, I have a need to do some shell scripting for some data analysis. The data are all residing on the vfat mounted partitions. The shell scripts won't run from the vfat drives but will run from any ext3 partition. When I take the commands out of the script and run them individually from the command line, they work just fine. Any idea what's going on and how to fix it?

A simple script:
#!/bin/bash
echo "Hi"

Output when I run the script from vfat partition (/mnt/win_h):
$ ./sscript
bash: ./sscript: /bin/bash: bad interpreter: Permission denied

Output when same script run from ext3 partition (/tmp):
$ ./sscript
Hi

My fstab:
$ more /etc/fstab
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/sda5 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/hdd4 /mnt/zip auto noauto,owner,kudzu 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0
/dev/sda6 /mnt/win_g vfat users,owner,rw,umask=000 0 0
/dev/sdb1 /mnt/win_f vfat users,owner,rw,umask=000 0 0
/dev/hde1 /mnt/win_h vfat users,owner,rw,umask=000 0 0
 
Old 02-08-2005, 02:53 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
You'll need to mount the partition so that all files can be executed or probably more secure - run it with:
sh /path/to/script
 
Old 02-08-2005, 03:04 PM   #3
agreenb
LQ Newbie
 
Registered: Feb 2005
Posts: 2

Original Poster
Rep: Reputation: 0
David,
I took your advice and did the following:

From /mnt/win_h/ I ran the script and got:
$ bash ./sscript
Hi

I'm really glad that worked, but I don't really understand why it did. Is there something I can do so that I can simply run ./sscript and it'll work from any partition?

Thanks so much for your help,
Adam
 
Old 02-10-2005, 01:35 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
If you want to execute the script directly you will need to have the execute bit set on the file. Since you can't chmod a file on a vfat filesystem you need to set the permissions on all files when the partition is mounted.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mounted vfat permissions n3tw0rk Linux - General 3 12-05-2003 04:41 PM
VFAT partition can not be mounted. WHY???? robertoneto123 Linux - General 4 10-16-2003 07:19 AM
Mounted drive permissions? Vfat kiteless Linux - General 3 08-29-2003 12:32 PM
Access a vfat mounted partition vector Slackware 2 02-25-2003 09:54 PM
VFAT mounted or Samba sx10 Linux - General 5 01-29-2002 10:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 09:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration