LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Permissions - Can't change on mountpoints (https://www.linuxquestions.org/questions/linux-newbie-8/permissions-cant-change-on-mountpoints-625638/)

Jinouchi 03-04-2008 09:37 AM

Permissions - Can't change on mountpoints
 
Yesterday I decided that I just couldn't take gaving a 3GB HDD anymore and found a 25GB that I could erase and use. That's what I'm using now. I copied my entire old hard disk to this one and now for some reason only the root user can write to my external storage devices. I've tried using chmod and chown logged in as root, but the best I can get are rwxr-xr-x permissions. chmod 777 /mountpoint doesn't give me fullpermisions. I've treid editing the fstab/mtab files but that didn't help (I'm not very esperienced with that so I may not have done it correctly(most likely). With my 3GB HDD I could access them just fine as a non-root user.

My question: How do I change the permissions/ownership of my external storage devives?

Subquestion: how should I have copied my hdd over to have maintained all original permissions?

weisso5 03-04-2008 10:36 AM

Hello Jinouchi,

When copying directories you always want to make sure you use the -p (--preserve) flag. This will: ( from man cp)

-p same as --preserve=mode,ownership,timestamps

--preserve[=ATTR_LIST]
preserve the specified attributes (default: mode,ownership,time-
stamps), if possible additional attributes: links, all


Regarding Permissions:
Here is a great links to a very simple explanation for permissions:
Permissions:
http://www.tuxfiles.org/linuxhelp/filepermissions.html
Owner/Group:
http://www.tuxfiles.org/linuxhelp/fileowner.html

Please post if you are having any more problems.

Jinouchi 03-04-2008 01:25 PM

Thank you for those URLs and the -p option.

Here's what happened when I tried chown again:
(I've condensed it to show only the dir I'm trying to change and replaced my username with "*****")
Code:

# dir -l /media
drwxrwxrwx  2 ***** root    4096 2008-03-03 15:59 TOSHIBA
# mount /dev/sda1 /media/TOSHIBA
# dir -l /media
drwxr-xr-x  4 root root    16384 1969-12-31 18:00 TOSHIBA
# chown ***** /media/TOSHIBA
chown: changing ownership of `/media/TOSHIBA': Operation not permitted
# chown -fv ***** /media/TOSHIBA
failed to change ownership of `/media/TOSHIBA' to *****

With chmod, it says it works, but it stays the same.

Code:

# dir -l /media
drwxr-xr-x  4 root root    16384 1969-12-31 18:00 TOSHIBA
# chmod -fv 777 /media/TOSHIBA
mode of `/media/TOSHIBA' changed to 0777 (rwxrwxrwx)
# dir -l /media
drwxr-xr-x  4 root root    16384 1969-12-31 18:00 TOSHIBA

My only (far out) idea is that, becuase I did a partial install of Debian to format the disk how I wanted, the "root" user is not THE root user, but A root user, the root user of the previous install. I don't know if that's possible, but I don't know why else it would deny access to the root user. (In the partial install, I didn't get far enough to enter root password though.)

I've also tried using sudo for chmod/chown, but the same thing happens. When I try to use the Nautilus GUI when logged in as root, after I check the box it un-checks it 1/2 second later.

Should I just try erasing this drive and using the -p option you mentioned to re-copy my old drive onto this one? Or is there a change I can make to the fstab/mtab to fix this? I'll try to do some more research on my own too.

weisso5 03-04-2008 03:35 PM

Let's start this copy all over again, just to make sure you aren't having a bigger issue. Please follow these steps:

Code:

shell# mke2fs /dev/sda1
shell# mount /dev/sda1 /mount/mountpoint
shell# cp -axp * /foo/bar /mount/mountpoint


Report back on any problems.

-weisso

Jinouchi 03-05-2008 10:55 PM

Thanks! Everything works fine except... it doesn't automount the swap partition. How do I do this/tell it to do so at boot?

Jinouchi 03-06-2008 08:22 AM

ok, I got the swap mounted, but why didn't it do it at boot?

weisso5 03-06-2008 09:35 AM

to auto-mount the drive you need to make an entry in your fstab file, here is an example:


Code:

# <fs>                  <mountpoint>    <type>          <opts>          <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/sda2              /boot          ext2            noauto,noatime  1 2
/dev/sda4              /              ext3            noatime        0 1
/dev/sda3              none            swap            sw              0 0
/dev/sdb1              /mnt/mountpoint  ext2            defaults        1 2

-weisso


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