Run shell on a removable disk in linux

I want to run a shell program in USB disk.
By chown, ownership of the file has been taken, but failed to change the file to executable with chmod +x. Why?
fxp007Asked:
Who is Participating?
 
Kerem ERSOYPresidentCommented:
Hi,

It seems that there was no eexecute permisson assignd to the mount.
- Mount the USB stick
- execute the mount command

you should see something like that
/dev/sdc1  /media/disk type vfat (rw,nosuid,nodev, shortname=winnt,uid=0)

If you see something like "noexec" this will cause nothing in ths volume be executed. Please try to remount the volume manually.

Cheers,
K.
0
 
farzanjCommented:
Did you do

chmod +x /path/file

You can copy the file first to your local directory and try it again.

You don't even need the file to be executable to run it.  Suppose on the first line of the script it says, #!/bin/bash, you know it is running with bash.  All you need to do is

bash /path/filename

This would run your script.
0
 
upanwarCommented:
I guess the USB drive has been mounted with noexec option and that is causing the problem.

Could you please show us output of below given command.

# mount

Or you can use the way as farzani told You can copy the file first to your local directory and try it again.

0
 
wesly_chenCommented:
> I want to run a shell program in USB disk
For borne shell/bash script, you can do
bash /path-to-usb-script
or
sh /path-to-usb-script

For csh/tcsh script:
csh /path-to-usb-script

It will run the script for you with or without executable bit.
Actually, the script calls the shell command that specify at the first line (#!/bin/bash).
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.