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 04-26-2005, 12:24 AM   #1
jagibbs
Member
 
Registered: Nov 2004
Location: Herndon, VA
Distribution: Xubuntu 14.04
Posts: 53

Rep: Reputation: 15
Still confused about users/folders/partitions


I've been using linux for about 8 months, (Debian Sarge, Mandrake 10.1, and now Ubuntu Hoary) but am still somewhat confused about how the filesystem is setup and how I can manipulate it to my advantage. Guess I've just been brainwashed from always using the Administrator logon of Windows. It's pretty straightforward there...install OS on the C: drive and put your files on the D: or E: or whatever other partitions you want. There never was all these other folders like in Linux.

THE REAL ISSUES/QUESTIONS:

I'm trying to set up a single user system on Ubuntu. Let's call this hypothetical user USER.

My first question is why, after logging in as USER, do I still see all the folders in the root directory? i.e. bin, lib, proc, mnt, boot, sbin...and so forth. I thought that each user of the system only has access to their own folder... in this case, /home/USER?? Shouldn't only root have access to all the other existing folders?

In addition to the above question I have one other. Because I wanted to separate USER's files from the system files, I created a separate partition called DATA for storing USER's files when partitioning my HD. I planned to keep all of USER's files on this separate HD partition. Something I've noticed is that everytime I open a file manager window or go to save a document in whatever program, it defaults to the /home/USER folder on the system partition. Do I need to make some type of symbolic link or something so that when I put files in the /home/USER location they actually physically get stored on the /DATA partition? or am I going to have to manually back out of the directory tree when saving to get to the /DATA folder?

thanks a bunch! I hope I can actually comprehend the setup of this OS one day!!

Last edited by jagibbs; 04-26-2005 at 12:27 AM.
 
Old 04-26-2005, 12:47 AM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
Question 1:
Nope. USER should have read access to almost all of the system's directories with one primary exception: the user directories for other users (such as root and another, hypothetical user named USER2). So why is that the case? In order for the user to do anything useful, that user needs to execute programs. Since programs are installed in a number of different places (/bin, /usr/bin, /usr/local/bin, and possibly others), that user needs read access to those locations. Similarly, when those programs start, they will typically want to read other information (global configuration, shared themes, fonts, etc.). Configuration files are usually somewhere in /etc, themes in /usr/share or /usr/local/share, fonts inside /X11, and all kinds of other places. Again, the user needs read access to these locations for a very good reason: any program the user starts runs with the permissions of the user that started it. In other words, if USER starts "ls", then ls can only list the contents that user has permission to read. Similarly, if a program needs to read config files or whatever else, USER needs to have permission to read those files.

One thing to note about all of the above: I've mentioned read access. USER should not have write access to any of those locations unless explicitly granted. USER's home space, and the /tmp directory are usually the only places USER is allowed to create/modify files (under a default setup). Typically a user can't do any harm to the system by reading files. Making changes by writing to them is where the danger lies.

Question 2:
It sounds like your trying to accomplish a very standard practice, but going about it in a slightly odd way. First, under Linux, you mount filesystems into the "master" filesystem tree. So there's no way to "separate USER's files from the system files" in that sense. If what you mean is you want all of the user's data stored on a separate partition/drive, then that's perfectly normal (and a recommended setup by most people). If that's the case, then don't mount a /DATA partition, simply mount the partition at /home, and create user directories in there. You need to make sure you've got a filesystem that supports permissions on /DATA (in other words, just about anything except FAT16, FAT32). Then all you have to do is tweak /etc/fstab, copy over any existing user directories, and that's it. Then you don't have to worry about linking anything at all. When the window manager opens up /home/USER, it will be opening USER's home directory located on its own, separate partition.
 
Old 04-26-2005, 01:09 AM   #3
jagibbs
Member
 
Registered: Nov 2004
Location: Herndon, VA
Distribution: Xubuntu 14.04
Posts: 53

Original Poster
Rep: Reputation: 15
thanks for the great reply Dark_Helmet. Your answer to #1 makes sense. After posting question #2 but before reading your response it somehow clicked in my head. At the time I'm typing this reply I've already logged in again after remounting the separate partition that I created as /home/USER instead of /DATA using the fstab file. I now see that all the folders that were created in the /DATA folder are now relocated in the /home/USER folder (but are physically kept on the separate partition). Just what I wanted.

One thing I noticed though, is that all the personal settings I created before remounting are lost. Is there some way to copy them over or do I need to reset everything? Since I'm using Gnome in Ubuntu maybe there are some Gnome user settings files??

Last edited by jagibbs; 04-26-2005 at 01:12 AM.
 
Old 04-26-2005, 01:35 AM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
You can copy the files over fairly easily. The only thing that might complicate matters is where you mount your former data partition.

If you mount the data partition as /home, then it's really simple. Mount the data partition as /DATA like previously, and then do:
Code:
cp -R /home/USER /data
If you mount the data partition as /home/USER, it's not quite as simple, but can still be done.
Code:
tar cvjf /tmp/USER_backup.tar.bz2 /home/USER
mount <data partition device> /home/USER
cd /home
tar xvjf /tmp/USER_backup.tar.bz2
rm /tmp/USER_backup.tar.bz2
If you run into problems, just post what happened and I'll try to help. My suggestion: even though you said it's a single-user system, my personal preference would be to mount the data partition as /home instead of /home/USER. The reason being this: you never know if you'll need to create another user with a need to a home directory. Some software might require you to create a user (though it's unlikely it would need a home directory), or maybe you'll want to create a "test" account to experiment. It would be much simpler (organizationaly speaking) to have all users' home directories on the same partition, and not having to worry about "stragglers" located on other disks/partitions if you ever need to backup that info.
 
Old 04-26-2005, 01:56 AM   #5
jagibbs
Member
 
Registered: Nov 2004
Location: Herndon, VA
Distribution: Xubuntu 14.04
Posts: 53

Original Poster
Rep: Reputation: 15
two things.

When I tried to remount the partition as /home I got an error when logging on which stated "Your home directory is listed as '/home/USER' but it does not appear to exist. Do you want to log in with the / (root) directory as your home directory?" If I said no, it wouldn't log on. If I said yes, it would try to log on, but gave an error.

After this, I changed the mount point of the partition to /home/USER and everything was fine. It allowed me to log on without incident and all my files were already present in the /home/USER directory. It seems there was no need to copy files from anywhere to anywhere... and why would there be? All I did was change the location to which the /DATA partition as mounted. The data never moved, just the mount point.

I think the way it's set up I could still add another user (call it USER2) in the future without hassle. If I wanted a similar setup as I have for USER, couldn't I make another partition (or use the same partition as USER uses) then mount it to /home/USER2? This probably will never happen as the only person who will ever touch the computer is me.

thanks. feel free to add to this just as an FYI (actually FMI), although I think I'm ok for now.
 
  


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
Hiding Folders from restricted users nowhere.elysium Linux - Security 3 11-17-2005 01:46 PM
html_public folders for users. William_Syd Fedora 2 11-29-2004 04:17 AM
Confused about partitions and file structure frankie_DJ Linux - Newbie 2 09-17-2004 06:25 PM
partitions: space used/free and folders inside joshfields Linux - Newbie 2 05-18-2004 07:21 PM
Dazed and confused about partitions arty62 Linux - General 10 11-05-2003 05:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:22 AM.

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