LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 08-10-2006, 12:00 AM   #1
royeo
Member
 
Registered: Jun 2006
Posts: 150

Rep: Reputation: 15
How to give myself root permissions


I created a file as root and saved it in a directory just underneath the root directory. Now I want to look at it but the system won't let me into the root folder. Is there some way I could give myself rights to go in there?

Thanks,
royeo
 
Old 08-10-2006, 12:28 AM   #2
fatra2
Member
 
Registered: Feb 2004
Location: Switzerland
Distribution: Fedora - RedHat - Mandrake - OpenSuse
Posts: 214

Rep: Reputation: 35
Hi,

I guess that the directory underneath the root directory is "/" itself. That is the system tree (where it all begins).

Did you look at the permission of the file you have created? Maybe if you change the permission so that root has access to it would fix your problem.

Cheers
 
Old 08-10-2006, 12:49 AM   #3
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Use the "su" or "su -" to switch to root whilst logged in as a normal user. If you need to access the file from a gui file manager in KDE, run Konqueror in root mode by doing "kdesu konqueror" from konsole or Kmenu -> System -> More Applications -> File Manager (Super User Mode).
 
Old 08-10-2006, 01:57 AM   #4
rhoekstra
Member
 
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 354

Rep: Reputation: 40
the 'root' folder is ambiguous. If you created a file, as user 'root' in the '/root' folder, you will not be able to access this as a normal user, nor do you want to be able to (security).
if you, however, wrote the file as user 'root' into the '/' folder, you should at least be able to SEE the file, and it would indeed be a matter of read rights on the file that prohibits you from reading (accessing) the file.

To resolve this issue, move the file to the home directory of your user account (/home/<username>) and 'chown' it so it is owned by yourself (and not 'root'). like 'chown <username> <filename'.

Hope this helps?
 
Old 08-10-2006, 02:12 AM   #5
dalek
Senior Member
 
Registered: Jul 2003
Location: Mississippi USA
Distribution: Gentoo
Posts: 2,058
Blog Entries: 2

Rep: Reputation: 65
Actually, unless you are root you can not see anything in the root folder as a regular user. Even in Konqueror the root folder shows up with a lock on it saying it can not be entered. Looks something like this when you try though:

Quote:
dale@smoker / $ cd /root/
bash: cd: /root/: Permission denied
dale@smoker / $
My question would be how he saved it to the /root folder when he has to have root permissions to do it.

 
Old 08-11-2006, 02:53 AM   #6
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Quote:
My question would be how he saved it to the /root folder when he has to have root permissions to do it.
Probably he logged in as root via a GUI or text interface at some point.
 
Old 08-11-2006, 09:46 AM   #7
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian 4.0 Etch
Posts: 1,349

Rep: Reputation: 49
Hey guys, he said he saved it in a folder just UNDERNEATH the root directory, not ABOVE. Traditionally, the root is counterintuitively thought of as at the "top", with all of the other directories branching out downward from it.

The directory he's refering to could be /boot, or /etc, or /whateverIthoughtof.
 
Old 08-11-2006, 09:49 AM   #8
rhoekstra
Member
 
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 354

Rep: Reputation: 40
including /root...

what is meant by 'in the root directory' is subject to interpretation.

one could mean / or /root.
 
Old 08-11-2006, 10:12 AM   #9
truthfatal
Member
 
Registered: Mar 2005
Location: Winnipeg, MB
Distribution: Raspbian, Debian, Slackware, OS X
Posts: 443
Blog Entries: 9

Rep: Reputation: 32
Here's a quick list of what's beneath my root directory (so the OP has something to look at.)
Code:
09:03 AM [user@localdomain:~]$ ls /
bin/   dev/  home/  lost+found/  opt/   root/  sys/  usr/
boot/  etc/  lib/   mnt/         proc/  sbin/  tmp/  var/
as you can see the "root" directory is different from the directory "/root/"
"/" is called the root directory by a lot of people, because it is the 'root' of the directory tree.

So:

I will assume you saved a file in the directory "/root/somedir/" while you were the root user and now want access to that file as a normal user.

You will want to become root, then move that file into a folder your user has access too, then - while still root - modify the permissions of the file so your user can do what it needs to to that file.

You probably do not want to give yourself root permissions, as that would likely be a serious security hole.

Last edited by truthfatal; 08-11-2006 at 10:17 AM.
 
Old 08-11-2006, 10:32 AM   #10
royeo
Member
 
Registered: Jun 2006
Posts: 150

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by dalek
Actually, unless you are root you can not see anything in the root folder as a regular user. Even in Konqueror the root folder shows up with a lock on it saying it can not be entered. Looks something like this when you try though:



My question would be how he saved it to the /root folder when he has to have root permissions to do it.


I was root at time.

royeo
 
Old 08-11-2006, 10:45 AM   #11
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,381

Rep: Reputation: 1109Reputation: 1109Reputation: 1109Reputation: 1109Reputation: 1109Reputation: 1109Reputation: 1109Reputation: 1109Reputation: 1109
As root, the current creator of the file, you can use chown to give ownership of the file to someone else (or to put it in a different "group"), and you can use chmod to change the permissions on the file.

For example, let's say that as root I built a file and now I want to give it to "joe" (who's in group "cool"), and I want to put it straight into his home-directory:

chown joe:cool joes_file
mv joes_file /home/joe


Now let's say that I want instead to place the file under the ownership of techwriter4, and put the file in a local directory where: techwriter4 can read or write it, as can anyone in the "writer" group, but all other users can only read it:

chown techwriter4:writers public.doc
chmod ug=rw,o=r public.doc
mv public.doc /usr/local/doc


The cryptic string ug=rw,o=r means: "the owning user (techwriter4), and members of the owning group (writers), may read or write to the file, but all others may only read it." Permissions also apply to directories (in particular, permission to delete a file is governed by the directory that the file sits in). You must not only have access to the file but you must also be able to find it (even if you cannot see it or search for it).

---
Many users who are accustomed to the "lazy" Windows environment sometimes want root (unrestricted) access to simply apply to themselves, but even the Windows community is beginning to see the folly of those ways. The permissions system of Linux or of any operating system is definitely your best friend.

/root is also set up as a "separate, opaque, tightly closed door" for a reason. Very often, this folder is mounted on a separate drive. There's an excellent chance that the things which are in there are "nobody else's business." They might be things that are critically needed to get a broken system back in action again. root is, of course, entirely free to do as she pleases, and to place files where and as she likes. Mortals rarely need to know anything about the affairs of the system deities ... ... and it's best to leave it that way.

Last edited by sundialsvcs; 08-11-2006 at 10:52 AM.
 
Old 08-12-2006, 03:01 AM   #12
jpence
LQ Newbie
 
Registered: Jan 2003
Location: Fullerton, CA
Distribution: Fedora Core 5
Posts: 7

Rep: Reputation: 0
If you just want temporary root privileges, try using sudo. You can log in to a non-privileged account, and then when you need access, you can run one process as root. Try "man sudo" for more details.
 
  


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
How to give permissions for users....... manikantha Linux - General 1 03-17-2005 04:27 AM
Getting my fstab to give proper permissions Esmo2000 Linux - Newbie 3 11-10-2004 12:21 PM
Not able to give execute permissions needanyhelp? Linux - General 4 08-20-2004 05:19 AM
How do I give mounting permissions? TheMusicGuy Linux - Security 4 04-20-2004 09:16 PM
Is there a simple way to give all permissions frontier1 Linux - General 3 02-28-2003 08:55 PM


All times are GMT -5. The time now is 05:07 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration