LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-01-2012, 07:20 PM   #1
szdavid24
LQ Newbie
 
Registered: Mar 2012
Posts: 19

Rep: Reputation: Disabled
Question Shell script run


Hi!

I'm really new in Linux, so forgive me if I ask a very simple question..

I've created a Shell script (for my minecraft server to start) and when I ran it for the first time, I did it in '/home/david/craftbukkit/' and now I want to place it somewhere else. I think I did something wrong, but now the linux doesn't asks me to run in terminal or just display the code, now it displays the text in TextEditor. I'm using linux with GUI (ZorinOS - Ubuntu)
and an other interesting thing is that whenever I want to edit the permissions it doesn't allows it neither the perms nor the execution as a program..
So my question is how to revert this thing, how could I place a shortcut on the desktop for it and why doesn't it allows me to edit the perms..?


Thank you in advance!
 
Old 03-01-2012, 07:57 PM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
@ Reply

Hi szdavid24,

Welcome to LQ!!!

Questions for you:

1. What are the permissions that are currently set on that file?
2. Which command are you using to change permission?
3. What error message do you get when you try to change the permission?
 
Old 03-01-2012, 08:38 PM   #3
szdavid24
LQ Newbie
 
Registered: Mar 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by T3RM1NVT0R View Post
Hi szdavid24,

Welcome to LQ!!!

Questions for you:

1. What are the permissions that are currently set on that file?
2. Which command are you using to change permission?
3. What error message do you get when you try to change the permission?
Hi! thx

Perms:
  • Owner: read&write
  • Group: None
  • Others: None
As I said, It doesn't allows me to change them, there are no error messages or anything, just for example when I tick the execution box it ticks out itself and it happens with the owner and others persmissions too!
I don't use any command, as I meantioned above, I have a GUI for this, mostly everything is accessible by that. So I just right click->properties->Permissions->And do what I want..

Thanks for your help
 
Old 03-01-2012, 09:16 PM   #4
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
@ Reply

Strange! Did you try copying this file to some other location and then edit the file permissions. Did you set any attribute on this file exclusively?

Who is showing up as owner of that file?
 
Old 03-02-2012, 02:53 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Is the script on a file system mounted with the noexec option?
 
Old 03-02-2012, 08:15 AM   #6
szdavid24
LQ Newbie
 
Registered: Mar 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
T3RM1NVT0R: Yes of course I tried.. The owner is 'david' and that's my account name.. These were the first things I've checked..
catkin: WHAT?! I'm sorry but as I said i'm new in this.. please describe it to me

Thx for your fast answers!
 
Old 03-02-2012, 11:04 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
From the mount man page, in the FILESYSTEM INDEPENDENT MOUNT OPTIONS sections: "noexec Do not allow direct execution of any binaries on the mounted filesystem".

It says "binaries" but applies to shell scripts too (I just confirmed by experiment) but netsearching suggests this behaviour was new in the past 2-3 years (?).

Sometimes the noexec option is implicit so the best way to find if it is in use is cat /proc/mounts
 
Old 03-02-2012, 11:13 AM   #8
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,362

Rep: Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004Reputation: 2004
Quote:
Originally Posted by szdavid24 View Post
Hi! thx

Perms:
  • Owner: read&write
  • Group: None
  • Others: None
As I said, It doesn't allows me to change them, there are no error messages or anything, just for example when I tick the execution box it ticks out itself and it happens with the owner and others persmissions too!
I don't use any command, as I meantioned above, I have a GUI for this, mostly everything is accessible by that. So I just right click->properties->Permissions->And do what I want..

Thanks for your help
What does it do if you try to edit the permissions on the command line?
Code:
chmod u+x <script>
 
Old 03-02-2012, 11:23 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by suicidaleggroll View Post
What does it do if you try to edit the permissions on the command line?
Code:
chmod u+x <script>
In my recent tests, that worked but command completion did not. The script was called try.sh and was the only file on the file system. Typing ./t and pressing Enter did not complete.
 
Old 03-02-2012, 03:29 PM   #10
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 476Reputation: 476Reputation: 476Reputation: 476Reputation: 476
@ Reply

@ szdavid24,

There is something goofy and it does appear to be random. Did you reboot the system and then try to set execute permission? I have tried with different scenarios but as long as I am the owner of that file I was able to change permissions. I tried setting immutable attribute on the file but if that was the case with you then you should have got a permission denied message.

@ catkin

Quote:
Is the script on a file system mounted with the noexec option?
If the file system is mounted with noexec option it does not prevent you from setting executable permission though it prevent it from executing them.

Last edited by T3RM1NVT0R; 03-02-2012 at 03:34 PM. Reason: fogot to put [/quote] at one end.
 
Old 03-02-2012, 10:51 PM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Quote:
Originally Posted by T3RM1NVT0R View Post
If the file system is mounted with noexec option it does not prevent you from setting executable permission though it prevent it from executing them.
Correct but ...
Quote:
Originally Posted by szdavid24 View Post
I'm using linux with GUI (ZorinOS - Ubuntu)
and an other interesting thing is that whenever I want to edit the permissions it doesn't allows it ...
The GUI (we don't know which GUI file browser is being used) may not allow it in the same way that bash completion is smart enough not to work despite the executable bit being set.
 
Old 03-04-2012, 10:09 AM   #12
szdavid24
LQ Newbie
 
Registered: Mar 2012
Posts: 19

Original Poster
Rep: Reputation: Disabled
Thx guyz!
I found the solution for the problem!
The problem was that I wanted to edit the perms on a drive which has been used by Windows and had NTFS file system.. And that's why it's worked on the Linux's drive!

Thanks a lot for your help!
ps.: @Catkin: I still don't know what are you talking about xD I'm sorry, but I hope that I'll be better in programming in Linux..
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] run a shelll script from another shell script in another directory raulab Linux - Newbie 12 02-22-2011 06:18 PM
in bash shell how to run shell script during startup rammohan04 Red Hat 2 07-31-2009 03:07 AM
MySQL Updates With Null When Perl Script Run From Shell Script ThisGuyIKnow Programming 6 08-12-2008 10:56 AM
Restrict a Shell Script to run from a shell bharaniks Linux - Security 7 08-26-2007 11:57 PM
how to run a shell script in the perl script sharad Linux - General 1 05-24-2006 04:23 AM


All times are GMT -5. The time now is 05:24 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration