LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 10-24-2015, 07:37 PM   #1
cilbuper
Member
 
Registered: Mar 2008
Posts: 88

Rep: Reputation: 0
Question chown not working on drives


OS Kubuntu 14.04

I have a number of drives mounted in my home directory but the user and group are listed as root. the path is /home/username/driveletter

What I do is do a sudo su and get root access. Then use the command:
chown -Rv username:username /home/username/driveletter

It runs through and is says "changed ownership of "./filepath/filename' from root:root to username:username

When I check in terminal or doplhin it still says that it is root:root.

What am I doing wrong>
 
Old 10-24-2015, 07:55 PM   #2
qlue
Member
 
Registered: Aug 2009
Location: Umzinto, South Africa
Distribution: Crunchbangified Debian 8 (Jessie)
Posts: 747
Blog Entries: 1

Rep: Reputation: 172Reputation: 172
How were the drives mounted? Did you mount them manually or are there entries in your /etc/fstab file for mounting them?
 
Old 10-24-2015, 08:10 PM   #3
JeremyBoden
Member
 
Registered: Nov 2011
Posts: 939

Rep: Reputation: 174Reputation: 174
It ought to work like this.
You should have a directory of '/' - this should be owned by root.
/ has some subdirectories - including home which should also be owned by root.
/home has some subdirectories - one for each username
/home/username should be owned by username.

You have chosen to allocate a "drive letter" - even though it is /home that is located on a drive.
The data from each user is physically intermingled on a single drive (although logically separate), so a "drive letter" makes no sense.

If you want to spread /home over a number of disks, you can - but it doesn't involve drive letters.
It's also quite complex for a relatively new user.
 
Old 10-24-2015, 08:47 PM   #4
cilbuper
Member
 
Registered: Mar 2008
Posts: 88

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by qlue View Post
How were the drives mounted? Did you mount them manually or are there entries in your /etc/fstab file for mounting them?

Most are mounted in fstab but the new drive I installed isn't and I was able to change the ownership on that one. I didn't do anything differently.
 
Old 10-24-2015, 08:50 PM   #5
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,961

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
Quote:
Originally Posted by cilbuper View Post
I have a number of drives mounted in my home directory but the user and group are listed as root. the path is /home/username/driveletter

What I do is do a sudo su and get root access. Then use the command:
chown -Rv username:username /home/username/driveletter
  1. Are you doing this after mounting the filesystem? Changing the ownership or permissions of the mount point directory while nothing is mounted there is pointless. That inode is completely overlaid by the inode (either real or simulated) at the root of the mounted filesystem.
  2. What type of filesystem are you mounting? The FAT variants do not support Unix permissions or ownership., and the permissions and ownership for the entire filesystem are set by mount options (uid=, gid=, umask=, etc.). See the manpage for the mount command for details.
 
Old 10-24-2015, 08:52 PM   #6
cilbuper
Member
 
Registered: Mar 2008
Posts: 88

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by JeremyBoden View Post
It ought to work like this.
You should have a directory of '/' - this should be owned by root.
/ has some subdirectories - including home which should also be owned by root.
/home has some subdirectories - one for each username
/home/username should be owned by username.

You have chosen to allocate a "drive letter" - even though it is /home that is located on a drive.
The data from each user is physically intermingled on a single drive (although logically separate), so a "drive letter" makes no sense.

If you want to spread /home over a number of disks, you can - but it doesn't involve drive letters.
It's also quite complex for a relatively new user.

Sorry for the misconfusion, I'm not really a newb but didn't know if this should go in "general or software" but I figured a newb might benefit from this as well.

The drive letter is because I have many of the same size so I assign something like 2TBA, 2TBB, 1TBA, 750GBA, etc. I'm the only one who uses the drives so they are in my home folder. So I have folders:

/home/user/2TBA
/home/user/2TBB
/home/user/1TBA
/home/user/1TBB
/home/user/1TBC
/home/user/1TBD
/home/user/750GBA

Is there a better way of keeping drives separated so I know what files are on which drive?
 
Old 10-24-2015, 08:55 PM   #7
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 5,872

Rep: Reputation: Disabled
Haven't tried it, but you could specify uid=<your_uid> in fstab.
 
Old 10-24-2015, 09:48 PM   #8
qlue
Member
 
Registered: Aug 2009
Location: Umzinto, South Africa
Distribution: Crunchbangified Debian 8 (Jessie)
Posts: 747
Blog Entries: 1

Rep: Reputation: 172Reputation: 172
Quote:
Originally Posted by cilbuper View Post
Most are mounted in fstab but the new drive I installed isn't and I was able to change the ownership on that one. I didn't do anything differently.
How any given drive behaves will depend to some extent on what file system it's formatted with and how it was mounted.
In my experience, drives that are formatted with Fat32 or NTFS need to be mounted with very detailed commands that specify exactly what you want. The defaults and automounting tend to do exactly what you don't want. The chown command doesn't always seem to work with these file systems simply because there is nothing to actually change on the file systems themselves.

With ext4 and other *nix like file systems, you can often use chown and change ownerships. This should usually work but may require sudo privileges depending on who the original owner is.

To get Fat32 and NTFS drives to behave, check the fstab entries and see if there are any changes you can make there. Or try mounting them manually using the full set of parameters in the mount command.

If you're the only person using these drives and you only need them to be accessible from Linux, you should use ext4 or some other *nix like file system. Only use NTFS if they absolutely have to be accessible from Windows too.


P.S: 'sudo su' is not recommended. Use 'sudo -i' rather.
 
Old 10-25-2015, 08:29 AM   #9
JeremyBoden
Member
 
Registered: Nov 2011
Posts: 939

Rep: Reputation: 174Reputation: 174
Quote:
Originally Posted by cilbuper View Post
Sorry for the misconfusion, I'm not really a newb but didn't know if this should go in "general or software" but I figured a newb might benefit from this as well.

The drive letter is because I have many of the same size so I assign something like 2TBA, 2TBB, 1TBA, 750GBA, etc. I'm the only one who uses the drives so they are in my home folder. So I have folders:

/home/user/2TBA
/home/user/2TBB
/home/user/1TBA
/home/user/1TBB
/home/user/1TBC
/home/user/1TBD
/home/user/750GBA

Is there a better way of keeping drives separated so I know what files are on which drive?
My apologies - I thought you were using Microsoft type drive letters...

If you wanted an equivalent of a giant /home spread over a number of disks, but in a flexible way you would need to use LVM.
This allows you to define:-
Physical volumes (based on actual disk partitions),
Volume groups - collections of one or more Physical volumes,
Logical volumes (LV's) - a partition of a Volume group into a number of data areas

You then create a file system on each LV and since it might be spread over several disks, there is no real limit to its size.
With care, LV's are resizable, there are also snapshot capabilities in LVM.

You would need to do a complete reload of your /home though - so not practical for you.

If you want to play with it, it can be done on a USB stick;
create a couple of partitions - these can be your PV's, one VG and several LV's
Format each LV with a file system...

See https://help.ubuntu.com/community/UbuntuDesktopLVM for more detail - including mounting your LV's.
 
Old 10-25-2015, 09:51 AM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,961

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
Quote:
Originally Posted by JeremyBoden View Post
If you wanted an equivalent of a giant /home spread over a number of disks, but in a flexible way you would need to use LVM.
This allows you to define:-
Physical volumes (based on actual disk partitions),
Volume groups - collections of one or more Physical volumes,
Logical volumes (LV's) - a partition of a Volume group into a number of data areas

You then create a file system on each LV and since it might be spread over several disks, there is no real limit to its size.
The huge problem with that is that all of the physical volumes used in that LV must be present and undamaged in order to mount the filesystem. Leave out just one of those drives and you've got nothing at all.
 
Old 10-25-2015, 10:57 AM   #11
JeremyBoden
Member
 
Registered: Nov 2011
Posts: 939

Rep: Reputation: 174Reputation: 174
Quite true - its just a way of mapping a single volume over one or more hard drives.
But it can have its advantages...

If used on a single hard disk and you want to have dozens of small volumes, each independently resizeable, then LVM could be a solution...
(In fact I use this kind of setup on an external disk, which holds backup copies of data directories from a number of different PC's).
 
  


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
Can't chown drives to my user:group valtam Linux - Software 4 06-07-2012 08:34 PM
chown not working donanap Linux - General 6 08-04-2009 11:28 AM
chmod and chown not working NirvanaII Mandriva 11 12-06-2008 09:08 PM
Proftpd: UserOwner and GroupOwner not working (can't chown) noisebleed Linux - Networking 2 01-21-2008 11:06 AM
chown not working for me? paulsh2k4 Linux - Software 3 10-04-2004 10:03 PM


All times are GMT -5. The time now is 12:48 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