Author Topic: Added later or secondary hardrives always belong to root (Solved)  (Read 907 times)

Camzl1

  • Guest
This has happened on every single distro I have used.  Whether I have the drive plugged in or not during installation doesn't matter.  The drives have always mounted automatically with no problems.  But everything in say, folder or file properties doesn't belong to me. User root is the creator and only has permissions.  Short workaround I have done on my own, being experienced with groups and all is simply make my user a part of that group 1001 or sometimes it's been 10001.  I have even created that group and added myself to it.  Again this works but not always.  Meaning that not every folder gets released to my user.  It usually leaves 1 or 2 out that I still cannot copy files out of or in to. I only have read permissions.

Any thoughts?  Thanks
« Last Edit: October 13, 2010, 01:44:36 PM by Camzl1 »

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11587
  • ----IOFLU----
Re: Added later or secondary hardrives always belong to root
« Reply #1 on: October 12, 2010, 06:45:52 PM »
This has happened on every single distro I have used.  Whether I have the drive plugged in or not during installation doesn't matter.  The drives have always mounted automatically with no problems.  But everything in say, folder or file properties doesn't belong to me. User root is the creator and only has permissions.  Short workaround I have done on my own, being experienced with groups and all is simply make my user a part of that group 1001 or sometimes it's been 10001.  I have even created that group and added myself to it.  Again this works but not always.  Meaning that not every folder gets released to my user.  It usually leaves 1 or 2 out that I still cannot copy files out of or in to. I only have read permissions.

Any thoughts?  Thanks

If you are the only user, choose the partitions you wish to write to as your normal user, and as root, in a terminal, use the chown command (change owner) to give the partition ownership to your normal user.

[root@localhost ~]# chown -R <user>:<user> /<mountpoint>          <Enter>

Replace <user> with your normal user's login name, and <mountpoint> with the full path to the mounted partition. The -R makes the command recursive, so your normal user will own all the files and directories on the partition. Repeat for each data partition you mount. Do not do this with a / partition from any other Linux installation. Those should be written to only by root.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Camzl1

  • Guest
Re: Added later or secondary hardrives always belong to root
« Reply #2 on: October 12, 2010, 07:04:02 PM »
Thanks old-polack. Here is what I am getting.

[eric@localhost ~]$ sudo chown -R <eric>:<root> /media/disk-1
bash: eric: No such file or directory


The mount point is coming from dolphin as far as where I get the address line of /media/disk-1

CLI newbie here please forgive.  

 
« Last Edit: October 12, 2010, 07:06:48 PM by Camzl1 »

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11587
  • ----IOFLU----
Re: Added later or secondary hardrives always belong to root
« Reply #3 on: October 12, 2010, 07:50:30 PM »
Thanks old-polack. Here is what I am getting.

[eric@localhost ~]$ sudo chown -R <eric>:<root> /media/disk-1
bash: eric: No such file or directory


The mount point is coming from dolphin as far as where I get the address line of /media/disk-1

CLI newbie here please forgive.  

 

Leave the <> off of the user and group names. Why are you using the root group in the command? Your normal user should not be a member of the root group. Also, why are you using sudo in the command instead of using su to get root permissions? We don't use sudo for commands requiring root permissions, so sudo is disabled by default in PCLinuxOS.

At the prompt, type su then press the Enter key. Give the root password when asked, then press the Enter key again. You will then have a proper root prompt, which will be red. At the prompt enter;

[root@localhost eric]# chown -R eric:eric /media/disk-1

then press the Enter key. Follow that with;

[root@localhost eric]# ls -l /media           <-- That's a lower case L not a number 1

and press the Enter key again.

Post your results.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Camzl1

  • Guest
Re: Added later or secondary hardrives always belong to root
« Reply #4 on: October 12, 2010, 10:06:34 PM »
Thanks Old Polack again.  Here is the output of the last command:  drwxr-xr-x  3 eric root 4096 1969-12-31 18:00 disk/
                                                                                          drwxrwxrwx 11 eric eric 4096 2010-09-18 13:36 disk-1/
Also in dolphin it says I own this disk now.

You have to forgive me on why I was leaving the brackets on.  I was just following syntax as I interpreted it.  

You are the first person to show me how to use this command in plain english instead of some where I have seen it as chmod #777 blah blah blah.

Again thanks for the easy button.  Any command line good reads?  I have the linux bible, but isn't very good.  It jumps around between different versions of linux too much.


« Last Edit: October 12, 2010, 10:10:30 PM by Camzl1 »

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11587
  • ----IOFLU----
Re: Added later or secondary hardrives always belong to root
« Reply #5 on: October 12, 2010, 11:51:10 PM »
Thanks Old Polack again.  Here is the output of the last command:  drwxr-xr-x  3 eric root 4096 1969-12-31 18:00 disk/
                                                                                          drwxrwxrwx 11 eric eric 4096 2010-09-18 13:36 disk-1/
Also in dolphin it says I own this disk now.

You have to forgive me on why I was leaving the brackets on.  I was just following syntax as I interpreted it.  

You are the first person to show me how to use this command in plain english instead of some where I have seen it as chmod #777 blah blah blah.

Again thanks for the easy button.  Any command line good reads?  I have the linux bible, but isn't very good.  It jumps around between different versions of linux too much.


If I may be allowed a bit of immodesty, If you click on my profile, then at the bottom, Show the last posts of this person, you'll find 359 pages of my posts, with a large percentage covering terminal commands with in depth explanations, given to real members of this community as we troubleshoot real problems on their machines. Some of them are addressed to members every bit as new to this, at the time, as you are now, leading them step by step through processes many long term, advanced users fear to tread, and reaching a successful repair of their system. Clicking the last entry in the path following the number of the post, will put you in the thread it was posted to. You can then start at the first page of that thread to put the series of posts into context.

There's a bunch of silliness in there too, as well as some in depth foolishness, but the commands used to systematically troubleshoot some very serious problems show up time and again, and coupled with the context of the various threads give far better examples of how the commands are used, what is expected of the commands, and what they reveal as regards a path to a solution than you'll find in most books. There's nothing like a real world problem, being systematically probed until it's solved, to give you a proper feeling of how the commands can be of use to you. If someone types the command wrong, you'll see the error, as well as the explanation of the typo itself, when the wrong results are posted back. Error messages actually mean something in Linux, giving real clues as to the individual path that is taken to arrive at where a problem originates, and then how to fix that problem. I seriously think that's as good a place to start as you'll find anywhere.

Sometimes a person gives up before the process is complete, and simply reinstalls his system, leaving the thread at a dead end. If you find such a thread, and the process, as far as it went, intrigues you, feel free to PM me and ask where I was headed. Include a link to the thread involved so I can read it and refresh my memory, and I'll explain as best I can.

You can also do this in the profiles of other members, so as you read various threads, and you see that someone appears to be proficient in a subject that has direct meaning/use for you, you can check out that persons past posts, to ascertain the depth of their knowledge on that subject, and other subjects as well, that you'll stumble across as you do your research. We have a lot of people here with great in depth knowledge in certain specific areas. We're not all experts on all subjects, but with our combined knowledge there's not much that we can't figure out. Best yet, from your point of view... none of us are bashful when it comes to sharing this knowledge. If we didn't like doing this, we wouldn't be here.

We were all lost newbies at some point, and in most cases someone more knowledgeable at the time offered help when it was needed. We repay that debt by following suit, helping those that are now where we once were. Sometimes we had to struggle very hard when there was simply no help available at all, and learn what was needed by trial and error. That can sometimes be down right traumatic, and we don't wish that hardship on any other person, so we smooth their path as we wish someone would have done for us. There is also an incredible satisfaction to seeing someone you've helped, in their earliest stages, who was sometimes on the verge of giving up, posting really expert help and advice to yet another newbie, a couple of years later. That's when I get the warm and fuzzies.  :D
« Last Edit: October 13, 2010, 12:05:05 AM by old-polack »
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Camzl1

  • Guest
Re: Added later or secondary hardrives always belong to root
« Reply #6 on: October 13, 2010, 01:42:17 PM »
Thanks for the kind encouragement.  I definitely will be looking up your profile and checking some of your previous post to learn a few things.  So lets mark this post as solved and again thanks for your help.

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6380
  • I'm going South
Re: Added later or secondary hardrives always belong to root
« Reply #7 on: October 13, 2010, 03:56:32 PM »
So lets mark this post as solved and again thanks for your help.

I don't think your problem has been completely solved. Everything old-polack has written in this thread is of course true (he seldom makes mistakes) but there are a few other things that you should also consider.

But before I get to them, allow me some nitpicking. When you write

Quote
being experienced with groups and all is simply make my user a part of that group 1001 or sometimes it's been 10001.  I have even created that group and added myself to it.

you simply aren't writing about a PCLinuxOS system. In PCLOS your first normal user will have the ID 500, and his/her group will also have the ID 500 (while both root and the root group will have the ID 0). If you have a group with the ID 1001 you either have an inordinate number of groups, or you are running another distro.

But let's forget about that. Your actual problem is that your changing the owner of /media/disk-1 probably won't survive your disconnecting and reconnecting your secondary hard drive. If it's mounted as /media/disk-1 it's probably mounted by HAL and the subdirectory disk-1 is most likely created on the fly by HAL, which means that it may not be there after a reboot and certainly not if you disconnect the drive in question. When you reconnect it, it may be called something else.

So if you want to be sure that your secondary hard drive is always owned by your normal user you should give it a line in /etc/fstab. In his previous posts O-P has numerous times explained how to do that.
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Camzl1

  • Guest
Re: Added later or secondary hardrives always belong to root (Solved)
« Reply #8 on: October 13, 2010, 07:48:51 PM »
Everything OP has been correct.  The disk is now labeled as just plain ol' disk.  The path is now /media/disk/.  I still have ownership.  How did it change?  Well I don't know all the linux details and you are probably right about HAL, but it got that way because I added a friend of mines mac hardrive to recover his files.  But one thing i disagree on, is that it still shows my user as owner. 

Quote
you simply aren't writing about a PCLinuxOS system. In PCLOS your first normal user will have the ID 500, and his/her group will also have the ID 500 (while both root and the root group will have the ID 0). If you have a group with the ID 1001 you either have an inordinate number of groups, or you are running another distro.

You are correct to an extent this disk drive has been my home folder for several distros.  Kinda one of the reasons I switched to linux was ease of saving things and trying other distros without loss of data under Normal circumstances.  But it has belonged to user 1001 and 10001 before, just give me the respect to not say things like I  am not running PCLOS.  Thanks again Old Polack for your KIND help and treating me with a little respect before someone hijacked my thread that you kindly Solved, as I had marked earlier.

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11587
  • ----IOFLU----
Re: Added later or secondary hardrives always belong to root
« Reply #9 on: October 13, 2010, 08:42:52 PM »
So lets mark this post as solved and again thanks for your help.

I don't think your problem has been completely solved. Everything old-polack has written in this thread is of course true (he seldom makes mistakes) but there are a few other things that you should also consider.

But before I get to them, allow me some nitpicking. When you write

Quote
being experienced with groups and all is simply make my user a part of that group 1001 or sometimes it's been 10001.  I have even created that group and added myself to it.

you simply aren't writing about a PCLinuxOS system. In PCLOS your first normal user will have the ID 500, and his/her group will also have the ID 500 (while both root and the root group will have the ID 0). If you have a group with the ID 1001 you either have an inordinate number of groups, or you are running another distro.

But let's forget about that. Your actual problem is that your changing the owner of /media/disk-1 probably won't survive your disconnecting and reconnecting your secondary hard drive. If it's mounted as /media/disk-1 it's probably mounted by HAL and the subdirectory disk-1 is most likely created on the fly by HAL, which means that it may not be there after a reboot and certainly not if you disconnect the drive in question. When you reconnect it, it may be called something else.

So if you want to be sure that your secondary hard drive is always owned by your normal user you should give it a line in /etc/fstab. In his previous posts O-P has numerous times explained how to do that.


The partition itself is now owned by eric:eric, not the directory. It no longer matters where it is mounted. When mounted to any directory, that directory will show the eric:eric ownership.

Example:

My /zbackup directory without a mounted partition.

[root@littleboy ~]# ls -l / |grep zbackup
drwxr-xr-x   2 root   root     4096 2010-04-16 21:51 zbackup/

My /zbackup directory with a mounted partition.

[root@littleboy ~]# ls -l / |grep zbackup
drwxr-xr-x  20 polack polack   4096 2010-08-11 10:57 zbackup/

Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11587
  • ----IOFLU----
Re: Added later or secondary hardrives always belong to root (Solved)
« Reply #10 on: October 13, 2010, 09:13:25 PM »
Everything OP has been correct.  The disk is now labeled as just plain ol' disk.  The path is now /media/disk/.  I still have ownership.  How did it change?  Well I don't know all the linux details and you are probably right about HAL, but it got that way because I added a friend of mines mac hardrive to recover his files.  But one thing i disagree on, is that it still shows my user as owner. 

Quote
you simply aren't writing about a PCLinuxOS system. In PCLOS your first normal user will have the ID 500, and his/her group will also have the ID 500 (while both root and the root group will have the ID 0). If you have a group with the ID 1001 you either have an inordinate number of groups, or you are running another distro.

You are correct to an extent this disk drive has been my home folder for several distros.  Kinda one of the reasons I switched to linux was ease of saving things and trying other distros without loss of data under Normal circumstances.  But it has belonged to user 1001 and 10001 before, just give me the respect to not say things like I  am not running PCLOS.  Thanks again Old Polack for your KIND help and treating me with a little respect before someone hijacked my thread that you kindly Solved, as I had marked earlier.

Be nice. Our Bald Brick friend has only your best interests at heart. Trust me, I know. The use of UID/GID out of the 500+ range is rare here, but not unheard off.

[root@littleboy ~]# cat /etc/passwd |grep polack
polack:x:1000:1000::/home/polack:/bin/bash

[root@littleboy ~]# cat /etc/release
PCLinuxOS release 2010 (PCLinuxOS) for i586

We're the odd ducks in the pond. ;D ;D ;D

Also he's right about having the same UID/GID for your normal user on all your installations. If you don't have that, you'll have to do the chown command each time you boot a different OS where the UID/GID is different, and again when you reboot to the present one, if you want to access your data.

That's how I came to have all my data partitions owned by 1000:1000, it's a remnant of my SUSE days. All my installations are now PCLinuxOS installations, but it's easier to set my UID/GID to 1000:1000 when I create my normal user than it is to change all my user owned partitions on all my hard drives. I'm too lazy for that. ;D ;D ;D
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Bald Brick

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 6380
  • I'm going South
Re: Added later or secondary hardrives always belong to root (Solved)
« Reply #11 on: October 14, 2010, 05:55:15 AM »
But it has belonged to user 1001 and 10001 before, just give me the respect to not say things like I  am not running PCLOS.  Thanks again Old Polack for your KIND help and treating me with a little respect before someone hijacked my thread that you kindly Solved, as I had marked earlier.

I'm sorry, Camzl1, if you feel I hijacked your thread.

I just thought I saw a potential problem and an anomaly in your posts, and I wanted to make you aware of them. Now it seems that the potential problem wasn't real. I was mistaken. But at least my mistake provoked O-P to post an explanation that many may find useful.

The anomaly, of course, is harmless. (It just struck me that your user and group IDs differed from the PCLinuxOS defaults and I wanted to point it out. My intention was just to make you aware of the fact, not to accuse you of running another Linux distro than PCLinuxOS -- which, by the way, isn't a crime or even particularly shameful. I couldn't imagine that this could be perceived as an insult. No disrespect was intended.)
« Last Edit: October 14, 2010, 08:58:23 AM by Bald Brick »
Feed the trolls!
They need it!

AMD Athlon 7450 Dual-Core Processor, 7.80 GiB RAM, Nvidia GeForce GT 120/PCIe/SSE2, OpenGL/ES-version: 3.3 0 NVIDIA 295.40, SBx00 Azalia (Intel HDA) soundcard, ‎Logitech B500 webcam, SAA7146 DVB card, HDDs: Seagate 250824AS, Western Digital WD10EAVS-00D

Camzl1

  • Guest
Re: Added later or secondary hardrives always belong to root (Solved)
« Reply #12 on: October 14, 2010, 08:06:29 PM »
Thanks Bald Brick.  Apology accepted.  I don't want to be perceived as the jerk in the forums.  Thanks for trying to help it just rubbed me the wrong way with that one statement, to which I am an adult, and to which I am over it.  Hope to be able to talk to you and maybe I will get to the place where you and Old Polack are in the Linux world.