Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
> It's a Usenet News Message? Strange? ( in Gnome it's a txt file).
Says who?
Since in Unix/Linux programs cannot rely conclusively on the extension of a file to find out its filetype, heuristics are being used to determine the type of data in a file according to its contents.
Sometimes, different heuristics lead to different conclusions.
All configuration files in /etc are formatted in a unique way depending on the program that interprets them, and may for example look similar to Usenet messages.
Strictly spoken, in most cases they are plain ASCII anyway and thus editable with any text editor.
--
Now to your question...
If I read that correctly, maybe you misunderstood the su command?
su changes your identity to that of another user. With no parameter given, to root (the superuser).
After that, you probably typed the name of the file you wanted to edit, by which you're telling the shell to execute it.
And since it is not set executable (= "execution not permitted"), you get this error message.
do this:
* type su
* type in your root password
* now you are root; any command typed henceforth is executed with root priviledges! So, when you now launch a text editors, thus is it.
* edit your file
What permissions does the file have? Do this in a terminal and paste the results:
Code:
ls -l /etc/powersave/cpufreq
Normally you would have to change the permissions (mode) of the file, edit the file, and assuming you want to put it back to the preferred permissions, change the mode back. This would usually mean doing these operations in a terminal. I'm assuming you're using the nano editor here:
Code:
su -
chmod u+w
nano file
chmod u-w
Some editors will allow you to save to read-only files, as long as the user can change the mode. This is a convenience feature of vim for example (using the :w! command).
Permission is root only. I did this:
su
password
chmod777 /etc/powersave/cpufreq
Then was able to open and edit and save with nano. The "Usenet News Message" file type through me off.
That's probably not advisable. 777 means readable, writable and executable by all users on the system! At the most you should have only added write permission for root. Excessive permissions is one of the reasons Windows has been a security minefield in the past (or course, Vista is the most secure OS ever written, so there won't be any more Windows security problems, honest).
Well, you just made that file readable, writable and executable by *absolutely everyone*! Although this of course solved your problem, it is generally a very bad idea, especially for files in /etc !!
If you want to learn the "guts" of Linux, I could explain you what this 777 actually means.
It is quite useful to understand how these octal numeric permission settings work, but in the beginning you should deal with that another way.
You can also change permissions with chmod in a much more intuitive way:
(Hm, it is actually much harder to explain then it is to understand. I hope I can make myself clear...)
What you did by chmod 777 could also be done with chmod ugo+rwx
Every file and directory has a user ownership and a group ownership. It has also permissions associated that define what the owner can do with the file, what the group the file belongs to can do with it, and what *everyone else* that is not the user and does not belong to the group can do with the file.
u means user g means group o means other (= everyone else)
Where the + is could also be a -
+ means "add the following permissions"
- means "remove the following permission"
r means readable w means writable x means executable
E.g., if you are the owner of a file secret-stuff.txt and do not want any other users of the system (if there are any) to access the file, you would type chmod og-rwx secret-stuff.txt (Which means "remove read, write and execute permissions for group and others, thus everyone but the owner)
E.g., if you have downloaded or written a shell script named automatic-stuff.sh and want to make it executable by you and its group you would type chmod ug+x automatic-stuff.sh
You get the idea...
Related commands are chown and chgrp. They're pretty self-explanatory...
cheers
~ fabian
Last edited by FnordPerfect; 01-14-2007 at 09:59 PM.
no, file permissions are generally persistent. There are a few exceptions, for example if your system uses the udev mechanism for generating the /dev/... files, they will be re-generated at boot (I think so anyhow - I'd be pleased to be corrected if that's not accurate).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.