LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   second hard drive wont let me create or move files? (https://www.linuxquestions.org/questions/linux-hardware-18/second-hard-drive-wont-let-me-create-or-move-files-576732/)

peterbug 08-13-2007 08:26 AM

second hard drive wont let me create or move files?
 
hey I've recently mounted my second hard drive onto sabayon linux, however when I try to move files on to my second hard drive I am told that I do not have permission to do this. how fix I change this, so that I can freely move files to and from the hard drive without running as root?

dracolich 08-13-2007 10:06 AM

What filesystem is the disk formatted as? For fat/vfat it needs to be mounted with additional options to allow users to access it:

mount -t vfat ... -o users,umask=002

If it's ext2/3 you need to use chmod or chown on individual files and directories. I'm not sure, but I think ntfs options are handled the same as vfat.

bigrigdriver 08-13-2007 11:01 AM

Also, inspect /etc/fstab or /etc/mtab to see if the partition is mounted read-only (ro) or read-write (rw). If it is read only, you will get the 'permission denied' message. You will have to remount the partition as rw in order to write to the partition.

peterbug 08-13-2007 04:10 PM

Quote:

Originally Posted by dracolich (Post 2857424)
What filesystem is the disk formatted as? For fat/vfat it needs to be mounted with additional options to allow users to access it:

mount -t vfat ... -o users,umask=002

If it's ext2/3 you need to use chmod or chown on individual files and directories. I'm not sure, but I think ntfs options are handled the same as vfat.

its ext3 and in both mtab and fstab it is rw so that should be ok =]

you mean every file I take or use from it will have to be done through the CLI? I checked the properties and it says the owner of the drive is root, how do I change that to user?



just in case I'm missing something here is my mtab :

Code:

/dev/mapper/VolGroup00-LogVol00 / ext3 rw,user_xattr 0 0
proc /proc proc rw,nosuid,nodev,noexec 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec 0 0
udev /dev tmpfs rw,nosuid 0 0
devpts /dev/pts devpts rw,nosuid,noexec 0 0
/dev/sda1 /boot ext3 rw,user_xattr 0 0
/dev/sdb1 /media ext3 rw,user_xattr 0 0
tmpfs /dev/shm tmpfs rw 0 0
usbfs /proc/bus/usb usbfs rw,noexec,nosuid,devmode=0664,devgid=85 0 0
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,noexec,nosuid,nodev 0 0

and here is my fstab :

Code:

/dev/VolGroup00/LogVol00 /                      ext3    defaults,user_xattr 1 1
/dev/sda1              /boot                  ext3    defaults,user_xattr 1 2
/dev/sdb1              /media                  ext3    defaults,user_xattr  1  2
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
tmpfs                  /dev/shm                tmpfs  defaults        0 0


dracolich 08-14-2007 08:57 AM

ext preserves the ownership and permissions of every directory and file. If the owner of a file is, say root:root with permissions of rwxr-xr-x, only root can save changes. Then the file next to it could be root:root with rwxrwxrwx (not likely but possible). So, if every file on that disk is owned by root:root, only root can change the ownership, and if the permissions are restrictive like rwx-r--r-- only root can save changes to the file.

You could chown -R root:users and then chmod -R 775 on the mount point, and if you want you can use your user's name instead of root. Or you can chmod -R 777 on the mount point to give everyone full access. I would use the chown option for security reasons. Don't forget the -R and make sure the disk is mounted first. And be extra careful that you execute it on the correct target. You don't want to chown the entire / or chmod 777 your entire /etc directory.

jay73 08-14-2007 09:42 AM

If your second disk has another Linux OS, the most convenient solution is to use the same UID and GID on both systems. If not, simply use chmod -R and chgrp -R as explained elsewhere in this thread.

fusilier 08-14-2007 12:37 PM

dracolich is correct, however ensure the drive unmounted before making the permission changes on the mount point so that whomever you would like to have right permissions have them. Then remount the drive.


All times are GMT -5. The time now is 08:33 AM.