LinuxQuestions.org
Visit Jeremy's Blog.
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 12-08-2010, 05:57 PM   #1
zdenekkrejci
LQ Newbie
 
Registered: Jul 2010
Posts: 11

Rep: Reputation: 0
Help with permissions


Hi guys Im trying hard to get familiar with Linux Ubuntu and Im a bit comfused on one thing. Why can I run an Open Office doc just by clicking and in terminal a have to change the permissions to run it even as a root?
I thought that in graphic mode Im the actual root no? And so when I run the terminal I should be still the root no?
 
Old 12-08-2010, 06:18 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Hello there,

Seems maybe you're mixing up a few aspects of files and users/ownership.

When you click on an Open Office Document, for example, it is a function of the operating system's (Ubuntu) desktop environment (Gnome, probably) to perform the action of launching OpenOffice (OOO) and opening your document with it. If the document were owned by the root user, and you did not have permissions to read it, OOO would not let you open it; you'd probably get an error of some sort, or it would open to a blank document.

In the terminal, when you open one, you are the same user as you are when just sitting there at the GUI (your desktop), that's the same username you used when you log into your desktop. In neither case are you the root user. On Ubuntu, to get root privileges, you usually use the `sudo` command. Also, typically you would not "run" a document, so maybe you're referring to a different type of file, when you say you need to change the permissions of it? What sort of file is that you're referring to?

For running shell scripts, for example, in your terminal, you can do it at least two ways. Whichever user you are, does not matter. One way requires that you set the executable bit on the file (the command is `chmod +x filename`), and then you execute it like:
Code:
shell$ ./filename
The other way does not require execute permissions:
Code:
shell$ sh filename
That way tells the `sh` binary (that's a symlink to your bash shell) to execute the commands inside the script.

Does that help some? Please ask more questions if you're still unclear.

Cheers!
 
Old 12-09-2010, 03:29 PM   #3
zdenekkrejci
LQ Newbie
 
Registered: Jul 2010
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for quick reply, well I thing I understand what do you mean but there is still one thing unclear. You say, that when i go to the terminal, Im the same user as I am in the GUI right? So why, I can some files for example the OO file run by clicking in the GUI and not in the terminal???
btw. I know now already that I can change the permissions to be able to run it in terminal but why should I do that when Im the same user? So I should have the same permissions...
 
Old 12-09-2010, 03:45 PM   #4
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Quote:
Originally Posted by zdenekkrejci View Post
...still one thing unclear. You say, that when i go to the terminal, Im the same user as I am in the GUI right?
Yes.
Quote:
So why, I can some files for example the OO file run by clicking in the GUI and not in the terminal???
Because the GUI, if we are talking about the desktop environment in general, and such things as icons and files that are on the desktop, is where one normally uses the mouse, and clicks things, to make things happen. This is the entire purpose, the raison d'etre, of the GUI.

The TERMINAL, is an application in itself, which runs inside the GUI environment (or, if you have switched to a Virtual Terminal, then you are not in the GUI, but it is still a terminal). In all terminals I am aware of, clicking things with a mouse, is not a supported activity. The terminal is (for all intents and purposes in this discussion) is a text-based terminal program. Things are done using commands, not a mouse (except for copy + paste text with mouse, if you like).
There are exceptions: nCurses for example (libraries for creating text & line graphics in a terminal) can react to mouse clicks; so, if you had an nCurses-application which showed a list of OO docs, and was coded such that when you click one, it opens OO, then great. But that is a specific application running in the terminal, NOT the terminal itself.
In short: text you see in the terminal, be it filenames or whatever, is basically not clickable.

Some terminals (or terminal apps, like maybe man, when configured certain ways, will present clickable links to web URL's when they appear in some text in the terminal, but exactly which terminals (and in what desktop environments), and how this works, I am unsure.
Quote:
btw. I know now already that I can change the permissions to be able to run it in terminal but why should I do that when I'm the same user? So I should have the same permissions...
You are confusing OWNERSHIP and PERMISSIONS. Permissions include, among others, READ, WRITE, and EXECUTE, on a per-user/group basis.
Just because you OWN a file (assuming we are talking scripts here again?) does not make it executable by the shell, by you or by anyone else. Imagine if we did not have such a thing as an "Executable" bit -- every possible filetype known to man, would have to be either executable, or not. It should be fairly clear that this would not be desirable. The executable bit can be used to control EXACTLY WHO can execute the file or program, in addition to simply whether or not it is executable.

Does this help? I seem to be getting convoluted, the more I write, so before I confuse both of us, I'll stop here and see how this does for you.

EDIT: But, further on the subject of understanding just what the terminal actually *is* - imagine back 40 or 50 years ago or whatever it was, before the GUI came along. Everything was text, on a "terminal" which was a machine with a screen and keyboard, but no brains inside. And there were probably no mice. Well, the modern-day terminal is an "emulator", which emulates the features and abilities of those olden-days terminals, albeit we have a few more features with our fancy, modern terminal emulators! But the main purpose, is to run commands, which are typed in, or saved in a script.

Last edited by GrapefruiTgirl; 12-09-2010 at 03:55 PM.
 
Old 12-09-2010, 07:20 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
Extending GrapefruiTgirl's fine explanation, it's important to note that you don't in fact 'run' an OO doc. The doc file is just a data file, not a program. What happens when you click on the file is that the GUI associates the doc with the the OO prog and calls the OO prog to open the file for you.
At the terminal you have to invoke the OO prog and pass the doc file name to it.
HTH
 
  


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] filesystem permissions question - making so user can't change permissions? c0pe Linux - Security 4 07-12-2010 10:06 AM
[SOLVED] Lack basic understanding of permissions(apache permissions problem) cK` Linux - Newbie 7 04-09-2010 12:49 AM
File permissions v. directory permissions Completely Clueless Linux - Newbie 7 07-09-2009 09:33 AM
file permissions OK, but command permissions? stabu Linux - General 2 10-05-2005 01:00 PM
getting a directory's permissions and creating a new one with the same permissions newbie1000101 Programming 1 04-10-2004 01:52 PM


All times are GMT -5. The time now is 08:02 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration