LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Changing permissions on external and internal hard disk (https://www.linuxquestions.org/questions/linux-newbie-8/changing-permissions-on-external-and-internal-hard-disk-4175444766/)

CSA60 01-08-2013 11:54 PM

Changing permissions on external and internal hard disk
 
Hello,

I am brand new to Linux and extremely frustrated. I bought a new computer Boxing Day and trying to set it up as a Myth TV box and entertainment centre but nothing seems to work correctly (at least not the 1st, 2nd or 3rd try). I've install Ubuntu 12.04 (to dual boot with Windows 8, now that was a nightmare) and MythTV and I am trying to add more storage.

This is my latest frustration. I've reformatted my external hard drive as ext4 and I've created a new partition on the internal hard drive (also ext4) but I can't access them because they have been assigned to the root and I have no permissions. I would like to create directories on those drives to store various media but Ubuntu won't let me do anything with them. I don't understand a word the say on Ask Ubuntu (they assume in depth knowledge there) and when I try it anyway, I usually end up screwing up my computer (I've had reinstalled Ubuntu three times now and had to repair the boot sequence about 5 times).

Thank you in advance for any help.

WFV 01-09-2013 12:35 AM

Do you mean the hard drive is now blank and formatted to ext4 (no Win8 or Ubuntu1204 on it)?
If so and you want it dual booting I believe you have to install Windows first, the installer should give you the opportunity to repartition the drive and reformat. If you will be partitioning it GPT leave 4MB unallocated in the beginning of the drive, then start the Windows Partition, leave 1MB unallocated between the Windows and (future) Ubuntu partition, and at least 1MB unallocated at the end of the drive, if partitioning MBR then 1MB is plenty at the beginning of the drive. Make sure you leave plenty of room unallocated for the Ubuntu install. Once Win8 is installed then install Ubunutu "side-by-side" (dual booting). When Ubuntu starts install it will open a partition manager, best ot run it manually (imo), you'll want tow partitions if MBR but if GPT you'll need 3, the first will be BIOS-GRUB, second will be "/" (no quotes, this is the root partition where all the essential OS stuff installs) the 3rd will be "/home" (this will be your home where you can set up working directories you dont need to set up in root such as for Myth TV, (Linux version of Windows "My Documents" only way better imo)) then complete the install follow the install directions. I'm actually giving directions for WinXP dual boot with Ubuntu 11.04, I have no expereince with Win8 so am told there are some differences. What about a full install of Ubuntu, then install VirtualBox app in Ubuntu and install Win8 in VirtualBox? with a new pc it should handle it fine. I run WinXP in virtualbox on LinuxMint 13 Xfce (ubuntu) and the Google TV finds it and the Windows media shares with no problem.

tommcd 01-09-2013 06:12 AM

Quote:

Originally Posted by CSA60 (Post 4865891)
I've install Ubuntu 12.04 (to dual boot with Windows 8, now that was a nightmare) ...

This should really not be such a nightmare.
Here is a great site with detailed tutorials on dual booting Windows with Ubuntu: http://members.iinet.net/~herman546/
Those tutorials are for Windows 7, but they should work just as well with Windows 8.
Quote:

Originally Posted by CSA60 (Post 4865891)
... I've reformatted my external hard drive as ext4 and I've created a new partition on the internal hard drive (also ext4) but I can't access them because they have been assigned to the root and I have no permissions. ...

The Parted Magic live CD is really easy to use to create partitions and format those partitions. It also has many data recovery tools as well. You may want to try using to create the partitions you want: http://partedmagic.com

As for the permissions on the problematic partitions, you can use the commands chown to change the ownership of the partitions, and you can use chmod to change the permissions.
Post the output of
Code:

sudo fdisk -l
here. Also tell us what partitions you are having problems with so we can help you set the permissions correctly.

CSA60 01-10-2013 12:00 PM

Thank you, I have already manged to install Ubuntu 12.04 beside Windows 8 but please understand - it is not just like installing beside Windows 7 and XP. Windows 8 is installed under a new UEFI system designed to stop anything other than windows 8 from installing itself on the computer. In order to bypass it you have to go into the BIOS and disable secure boot (which is discouraged by by a big red warning box) and once that is disabled you have to activate legacy systems so that the computer will look to your DVD drive to boot sources. You then have to disable windows 8 boot manager under (or at least move it below the DVD Drive in boot order) in order to access your boot disk.

That did take time but I have to admit that much of my troubles stem from the fact that I first mistakenly loaded Ubuntu 12.10 which doesn't play well with Myth TV so I had to uninstall that in order to load 12.04. This involved reformatting partitions on the hard drive which in turn corrupted the grub and I was confronted with "grub rescue" the next time I booted up my computer. Anyway, I sorted that all out but most recently I encountered grub rescue again when I reclaimed the greater portion of the C: drive which has all the windows system files on it.

But I digress.

In answer to your question, below is the output from sudo fdisk -1. It looks like there is a problem with my partition tables I'm going to have do something about (I will probably need help with that too). Also it isn't showing all my partions (probably the same problem) so I've also added the output to sudo blkid.
The disks I want permission for are:
/dev/sda6: UUID="3e038c56-47f5-4884-8c2d-7d4d6d84d28a" TYPE="ext4"
and
/dev/sdf1: UUID="8c4794be-5c49-4f1e-a318-e4b11c0b7117" TYPE="ext4"

Thanks Again

OUTPUTS

fdisk -l

WARNING: GPT (GUID Partition Table) detected on '/dev/sdf'! The util fdisk doesn't support GPT. Use GNU Parted.



WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x70cb1613

Device Boot Start End Blocks Id System
/dev/sda1 1 1953525167 976762583+ ee GPT
Partition 1 does not start on physical sector boundary.

WARNING: GPT (GUID Partition Table) detected on '/dev/sdf'! The util fdisk doesn't support GPT. Use GNU Parted.


Disk /dev/sdf: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdf1 1 976773167 488386583+ ee GPT



sudo blkid

Device Boot Start End Blocks Id System
/dev/sdf1 1 976773167 488386583+ ee GPT
chris@Server:~$ sudo blkid
/dev/sda1: LABEL="Windows RE tools" UUID="8046E66C46E66300" TYPE="ntfs"
/dev/sda2: LABEL="SYSTEM" UUID="CA28-48E8" TYPE="vfat"
/dev/sda4: LABEL="OS" UUID="6CBA8289BA82500E" TYPE="ntfs"
/dev/sda6: UUID="3e038c56-47f5-4884-8c2d-7d4d6d84d28a" TYPE="ext4"
/dev/sda7: UUID="e6cd4226-01cb-412c-900f-4f05e41f1acb" TYPE="swap"
/dev/sda8: LABEL="Recovery Image" UUID="AA3CC9A73CC96EBF" TYPE="ntfs"
/dev/sda9: LABEL="Internal" UUID="360e7eb6-6f04-4703-95cb-3d2e71e8b3f4" TYPE="ext4"
/dev/sdf1: UUID="8c4794be-5c49-4f1e-a318-e4b11c0b7117" TYPE="ext4"

suicidaleggroll 01-10-2013 12:12 PM

Just chown/chmod the mount location if you want regular users to have access to the new drive.

CSA60 01-10-2013 12:50 PM

Did I mention I'm a Newbie?

lleb 01-10-2013 01:32 PM

as root, or via sudo as you are running Ubuntu issue the following commands:

Code:

[ray@centos ~]$ df -Th
Below is what mine looks like on my server
Code:

Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/mapper/vg_centos-lv_root
              ext4    50G  1.9G  45G  4% /
tmpfs        tmpfs    939M    0  939M  0% /dev/shm
/dev/sda1    ext4    485M  63M  397M  14% /boot
/dev/mapper/vg_centos-lv_home
              ext4    1.8T  792G  898G  47% /home

The reason for this is so that we can take the information from fdisk -l you posted earlier to identify what device and partition is being used for what OS and what is not so we can mount them properly. The fdisk you posted has some odd file type ee sorry, but I am not sure what that is as it is NOT ext2,3,4 as you mentioned above in your OP about formatting.

Now sda6 and 9 along with sdf1 are formatted ext4, those we can start with. I am going to guess that sda9 is the partition you formatted internally and sdf1 is the external drive.

First step, assuming my guess above is correct, is to create a mount point for those devices.

Code:

#mkdir /path/to/mount/point
Do that for both devices.

ex:

Code:

mkdir /mnt/internal
mkdir /mnt/external

It does not matter what you call the mount point as long as it is a legal file system name. so no spaces or odd characters like (){}\*&^%$#@!~, etc. something simple.

Now chmod/chown them so that any user can access them. You have a few options here.

1. make it so they are owned by a specific user. This is best practice.
2. make it so they are universally accessible by ANYONE. Not best practice, but if you are secure that no one from the outside world is going to have easy access to the data, then it is safe enough.

option 1
Code:

chmod -Rf 755 /mnt/internal
chown -Rf user:group /mnt/internal

Now on the chown you will have to use the proper user:group settings for your system. an easy way to perform that task is just to run ls -laF in a directory owned by the user you wish to have control over the device.

option 2
Code:

chmod -Rf 4777 /mnt/internal
chown -Rf user:group /mnt/internal

The biggest difference here is the lack of security provided by the sticky bit (the 4 in front of the 777) and everyone will have read, write, execute access to the entire device. That means guest and users who you might not want to have access to that data can and will be able to do anything they would like. This is no different then running MS Windows as Administrator for everything. just as bad an idea.

***note, you will need to do the same thing for sdf1.

Next step is to mount and test that you have the desired access.

Code:

# mount -t ext4 /dev/sda9 /mnt/internal
mount -t ext4 /dev/sdf1 /mnt/external

Now that the devices are mounted, set the permissions and ownership again exactly as above. Earlier you only set permissions to a folder. Now you have mounted a device inside that folder and you must set the permissions on that device. Once you have done that you should have access to the data on the device as user.

***note, again all of this will need to be performed as root or via sudo, the normal user in linux does not have the privileges to perform these tasks, nor should he.


hope that helps.

CSA60 01-10-2013 02:12 PM

Thanks lleb, This is much more helpful.

There is a lot here so I'll have to try this, this evening. A few questions though.

1) I entered "df -Th" and got the readout below. It looks like the system can't see the windows partions or my sda9 (or something). Does that matter with respect to your instructions? I formatted these drives with GParted (which still tells me the external drive is ext4).


Filesystem Type Size Used Avail Use% Mounted on
/dev/sda6 ext4 56G 7.0G 46G 14% /
udev devtmpfs 4.6G 4.0K 4.6G 1% /dev
tmpfs tmpfs 1.9G 896K 1.9G 1% /run
none tmpfs 5.0M 0 5.0M 0% /run/lock
none tmpfs 4.6G 80K 4.6G 1% /run/shm
/dev/sda2 vfat 356M 37M 320M 11% /boot/efi
/dev/sdf1 ext4 459G 198M 435G 1% /media/8c4794be-5c49-4f1e-a318-e4b11c0b7117

2) Also, do you think I should be concerned with the warning from my fdisk readout?

WARNING: GPT (GUID Partition Table) detected on '/dev/sdf'! The util fdisk doesn't support GPT. Use GNU Parted.


3) Finally is the first command you gave (i.e. #mkdir /path/to/mount/point) real or is it just to illustrate format? The reason I'm confused about this is because your examples are somewhat different (i.e. mkdir /mnt/internal: No # sign and no path entered). Sorry but I'll fall back on the "I'm a Newbie" excuse as long as I can.

Anyway, thanks again. I have to leave now so I'll have a go at it tonight.

suicidaleggroll 01-10-2013 03:52 PM

In answer to your questions

1) df only reports partitions that are currently mounted. If the drive exists but is not mounted, then df will not show it. The reason lleb asked you to post the output is not so we could see the new drives you want to mount, but so that we could see which of the drives listed in your fdisk -l output are the system drives (/dev/sda6 and /dev/sda2, which you can see in your df command) and which are the new drives you want to mount.

2) That is fine. Drives with >2TB partitions require the GPT partition table, which fdisk does not support. fdisk will still show you information about the drive, but it cannot be used to do partitioning, you have to use parted for that.

3) Some users here put # or $ symbols before the command to represent the command prompt at the shell, it's not part of the actual command. Obvious the "/path/to/mount/point" isn't real, you need to replace that with the actual path where you want to mount the drive, but that's all.

lleb 01-10-2013 03:57 PM

suicidaleggroll got it on the head. the # is to represent you are issuing the command as root, not as user. see my notes above about all of those commands needing to be performed by root, or via sudo, not as user.

yancek 01-10-2013 06:22 PM

Quote:

Also, do you think I should be concerned with the warning from my fdisk readout?
No. All it is doing is giving you information and telling you that fdisk doesn't support GPT and telling you to use GParted instead to get accurate information. GParted is usually on Ubuntu Live CDs.

jschiwal 01-10-2013 08:52 PM

Mount the external drive before using chown and chmod on the mount point.

CSA60 01-10-2013 10:17 PM

Sucess! Thank you one and all.

lleb 01-12-2013 11:15 AM

glad it worked. please mark thread as [SOLVED] please.


All times are GMT -5. The time now is 09:32 AM.