Reply
Thread Tools
cmdowns's Avatar
Posts: 100 | Thanked: 13 times | Joined on Mar 2008
#1
Can someone please tell me how to change file permissions in xterm? I´m a linux noob. The command I picked up at linuxcommad.org says it should work like so:

chmod 755 [file_name]

in order to set the file permissions to rwxr-xr-x. While logged in as root, xterm doesn't seem to do anything with this. It doesn't give me an error message, it doesn't seem to respond at all. I just get another # command prompt. And, ls -l makes it clear that the permissions remain the same as before the command.

I´m trying to begin to teach myself python, I´m just beginning to work my way through the online guide at byteofpython.info. I´ve saved my first helloworld.py and the guide now instructs me to change the file permissions as so

chmod a+x helloworld.py

But that gives me the same effect as chmod 755, none at all.

What am I doing wrong?
 
scumgrief's Avatar
Posts: 127 | Thanked: 15 times | Joined on Feb 2008
#2
Good job working on learning python!!! I have been reading that text for awhile but not very much of it... Im sometimes a very slow reader.

Anyways, did you move that python file on to your tablet from a linux based computer?
__________________
Scraping money together to get a n810 and/or n800.
 
cmdowns's Avatar
Posts: 100 | Thanked: 13 times | Joined on Mar 2008
#3
Originally Posted by scumgrief View Post
Anyways, did you move that python file on to your tablet from a linux based computer?
Actually I wrote ok my n800 in PyGTKEditor. It runs fine if I type

python helloworld.py

in xterm.
 
Saturn's Avatar
Posts: 1,648 | Thanked: 2,122 times | Joined on Mar 2007 @ UNKLE's Never Never Land
#4
Originally Posted by cmdowns View Post
Can someone please tell me how to change file permissions in xterm? I´m a linux noob. The command I picked up at linuxcommad.org says it should work like so:

chmod 755 [file_name]

in order to set the file permissions to rwxr-xr-x. While logged in as root, xterm doesn't seem to do anything with this. It doesn't give me an error message, it doesn't seem to respond at all. I just get another # command prompt. And, ls -l makes it clear that the permissions remain the same as before the command.

I´m trying to begin to teach myself python, I´m just beginning to work my way through the online guide at byteofpython.info. I´ve saved my first helloworld.py and the guide now instructs me to change the file permissions as so

chmod a+x helloworld.py

But that gives me the same effect as chmod 755, none at all.

What am I doing wrong?
Maybe this question is stupid..

Are you sure you wrote the filename correctly?

(you could use the tab for word completion)

Anyway, a copy/paste of the xterm output would allow people here to help you more.

Hope it helps.
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#5
chmod doesn't say anything when using it.

chmod a+x ./helloworld.py should work fine and put:
#!/usr/bin/python as the first line in the file.

And you run files in the same dir with a ./ in front.

so, cd "/where/the/file/is"
chmod a+x ./helloworld.py
./helloworld.py

Should work.
 
cmdowns's Avatar
Posts: 100 | Thanked: 13 times | Joined on Mar 2008
#6
Thanks for getting back to me. This is definitely the best forum I've ever used as far as user helpfulness goes.

Anyway, I followed qwerty12's instructions, and this is what I get:

/media/mmc1 # chmod a+x ./helloworld.py
/media/mmc1 # ls -l
[bunch of other files on my memmory card]
-rw-r--r-- 1 user root 632 Apr 11 09:54 hello_world
-rw-r--r-- 1 user root 65 Apr 11 19:03 helloworld.py
-rw-r--r-- 1 user root 695088 Mar 26 11:39 maemomind_0.6_armel.deb
drwxrwxrwx 3 user root 16384 Mar 21 23:17 map
/media/mmc1 # ./helloworld.py
/bin/sh: ./helloworld.py: Permission denied

Can anyone spot my error?

And BTW, what the difference between using chmod 755 and chmod a+x? Are they the same thing?
 
GeneralAntilles's Avatar
Posts: 5,478 | Thanked: 5,222 times | Joined on Jan 2006 @ St. Petersburg, FL
#7
Originally Posted by cmdowns View Post
And BTW, what the difference between using chmod 755 and chmod a+x? Are they the same thing?
The numbering is octal notation for modes, and is generally more efficient for making very radical changes to the permissions, while the string mode is generally used for small changes—both modes basically accomplish the same task

Octal
Code:
chmod [octal number] files(s)
There are three modes, read, write and execute (4, 2 and 1, respectively) and three references, user group and other (one for each digit from left to right) So, say, you wanted to set all permissions to rwx for everybody:

Code:
chmod 777 files(s)
The user field is rwx, the group field is rwx, and the other field is rwx, r, w and x add up to make 7 for each field, so you get 777.

Let's say you wanted to set rw-r--r--:

Code:
chmod 644 files(s)
String
Code:
chmod [reference][operator][modes] files(s)
String mode is essentially adding or removing bits you pick the people (user, group, other or all), you pick the operator (add, remove or set) and you pick the permissions (read, write, or execute). So, say we want to make the file executable, and set the execute bit for everybody (allow everybody to execute the file):

Code:
chmod a+x files(s)
Let's say we wanted to set the group and other to r-x:

Code:
chmod ug=rx files(s)
There's a rough overview, more specifics can be found at the wikipedia article on chmod.
 

The Following 2 Users Say Thank You to GeneralAntilles For This Useful Post:
pipeline's Avatar
Posts: 693 | Thanked: 502 times | Joined on Jul 2007
#8
Originally Posted by cmdowns View Post
/media/mmc1 # ./helloworld.py
/bin/sh: ./helloworld.py: Permission denied

Can anyone spot my error?
you've been trying to set exec on a file on mmc1 which wont work cause the filesystem is fat32

- try python helloworld.py
- or move py file to home directory, chmod there and run there

you could also format the mmc to filesystem that supports permissions like ext2 or try mounting mmc1 without the noexec option in /etc/fstab but not really worth it for py files which are interpreted anyways
 

The Following 3 Users Say Thank You to pipeline For This Useful Post:
cmdowns's Avatar
Posts: 100 | Thanked: 13 times | Joined on Mar 2008
#9
Originally Posted by pipeline View Post
you've been trying to set exec on a file on mmc1 which wont work cause the filesystem is fat32

- try python helloworld.py
- or move py file to home directory, chmod there and run there

you could also format the mmc to filesystem that supports permissions like ext2 or try mounting mmc1 without the noexec option in /etc/fstab but not really worth it for py files which are interpreted anyways
Thanks so much. Mystery solved!
 
Reply


 
Forum Jump


All times are GMT. The time now is 22:07.