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.
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?
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).
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'.
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:
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.
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.
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.
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:
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.