# Solved: Need Permission to Copy Files in Ubuntu Live CD



## halcour

I use a media player with an external USB 4-disk storage device, hd's formatted EXT3. I sometimes need to access these hd's via my computer but I'm running Win 7, which is very fickle with EXT3 so I would like to just use an Ubuntu live cd. Ubuntu sees the hd's fine but when I try to copy a file from one hd to another (both EXT3) it says I don't have permission.

So how do I get permission? If I have to use the terminal to do this please be specific and go step by step because I'm completely ignorant when it comes to Linux and this is really all I need to use it for. Thanks much!


----------



## saikee

If you get yourself into a terminal and become a super user which is to type


Code:


sudo su

and supply the normal user password. For a Ubuntu Live CD no password is required!

As a super user you have the permission to do anything you want "at the terminal".

I believe if you mount the partition, say it is the device /dev/sdb1 on a mounting point say /mnt/sdb1 using commands


Code:


mkdir /mnt/sdb1
mount /dev/sdb1 /mnt/sdb1
ls /mnt/sdb1

You can copy, move ,delete, edit................. any of the files at the terminal. There is a good chance you can do drag and drop too at the desktop on the folder you have just mounted yourself.

To unmount it use the umount command like this


Code:


umount /dev/sdb1

Mounting a device on the system filing tree to access information is a wonderful activity in Linux. As a root user you can copy all folders, including subfoolders from one directory (say /mnt/sdb1/movies) to another (say /mnt/sdc2/temp) using 


Code:


cp -R  /mnt/sdb1/movies/*  /mnt/sdc2/temp


----------



## halcour

My gosh, I have to go thru all that just to copy a file? I thought Ubuntu was supposed to be a "simpler Linux".

Thanks, I'll give it a try.


----------



## saikee

It is the same in every system if you run an operating system with ownership for the files. In Vista and Win7 you might get away to log in as Admin but Ubuntu differs from other Linux by requiring no root (equivalent to Admin) log in to the desktop. None what so ever. That is a safe way to operate an OS because during any cyber attack no damage is possible to the main system except the files owned by an ordinary user.

UBuntu can be overruled by altering the system setting to log in as root but this is not recommended. If you want to drag and drop files freely use other distros like from the Slax and the Slackware families. Most modern Linux, from Debian, Mandriva and Fedora will place the same restriction on the desktop but in any Linux terminal you can always work as root. It is a safe arrangement now being copied by the MS systems.


----------



## flan_suse

How do you mount the drives? Do you do it via the GUI? If so, it will mount the drives under /media. List the contents of the /media folder:



Code:


ls -l /media

It will show you who the owner is, and what permissions are on the directories. For example, you might see something like this:



Code:


drwxr-x-r-x root admins mediahdd

The letter "d" means it is not a file, but a directory. The folder "mediahdd" is owned by the user "root" and the group "admins". The permissions are as follows: owner permissions, group permissions, other permissions. In this case the owner (root) has *r*ead, *w*rite, and e*x*ecute permissions. The group (admins) has only *r*ead and e*x*ecute permissions. Everyone else (other users not in the group "admins") have only *r*ead and e*x*ecute permissions.

Let us know what it shows when you list the contents of the /media directory. Remember, if you use the GUI (click / double-click) it will automatically mount the file systems under /media; otherwise, if you do it manually, you can decide where to mount them.

With that said, it is possible that you can change the permissions of the folders you wish to transfer files between so that you never have to repeat tedious steps over and over. All of this can even be done in the GUI, as well. It's a matter of right-clicking the folder > Properties > Permissions.

Remember with Linux, and basically most operating systems, there are usually _multiple_ ways to solve or fix something.


----------



## halcour

This what it says:

[email protected]:~$ ls -l /media
total 12
drwxr-xr-x 10 1001 1001 4096 2010-04-30 12:49 PCH FILM 1
drwxr-xr-x 11 1001 1001 4096 2010-04-30 12:49 PCH FILM 2
drwxr-xr-x 5 1001 1001 4096 2000-01-01 08:08 PCH FILM 3
[email protected]:~$ 

When I right-click on the drives and choose Properties - Permissions, it says the "permissions could not be determined".

Incidentally, I tried the Slax livecd but it would only see one of the three drives in the bay so that has its own set of problems. I'd rather see if I can do it in Ubuntu first.

Thanks.


----------



## lotuseclat79

Hi halcour,

When you boot up into the Ubuntu Live CD, if you issue the command:
$ mount
what I see for the Live CD of Ubuntu 9.10 is:
/dev/sr0 on /cdrom
and for the Linux filesystem in RAM:
/dev/loop0 on /rofs type squashfs (rw)

To see the hard drives in your system issue the command:
$ sudo fdisk -l

Then to be able to write to any ext3 hard drive from any directory in RAM do the following:
From the fdisk -l output above, you should see your Linux hard drive partitions as follows:
/dev/sdb2 14 9538 76509562+ 83 Linux
This is my relevant ext3 partition - Note the 83 for the Id

First, you must make a mount point directory before issuing the mount command (using my output as an example):
$ sudo mkdir /tmp/sdb2

Then issue the mount command as follows:
$ sudo mount -v -t ext3 /dev/sdb2 /tmp/sdb2

After you issue the mount command (as above) then issue it again without any parameters to compare it withe the first issued mount command without parameters to see the differences.

You should be root to do the write (commonly with a cp -p <file path> <destination path>):
$ sudo -i
# cd <directory path>
# cp -rp <subdirectory> <destination path>
where destination path is in the /tmp/sdb2/... (set of directories you are working with on the destination hard drive)

-- Tom


----------



## flan_suse

halcour said:


> This what it says:
> 
> [email protected]:~$ ls -l /media
> total 12
> drwxr-xr-x 10 1001 1001 4096 2010-04-30 12:49 PCH FILM 1
> drwxr-xr-x 11 1001 1001 4096 2010-04-30 12:49 PCH FILM 2
> drwxr-xr-x 5 1001 1001 4096 2000-01-01 08:08 PCH FILM 3


That shows that those three folders (mount points from file systems) might have been created on another Linux system, where the owner had a user ID of 1001, and the group had a group ID of 1001. Since you are not the "owner" when you boot into the LiveCD (Ubuntu LiveCD uses a user called "ubuntu" with a uid of 1000, I believe) then you cannot change the permissions. You would need root privileges to change the permissions and ownership of those directories.

If you simply want complete ownership and control of the files, do this:



Code:


sudo chown -R root:root /media/PCH\ FILM\ 1
sudo chmod -R 777 /media/PCH\ FILM\ 1

The first command will change the ownership to the root account and the root group, and the -R parameter will do this recursively for all files and folders within. The second command will give read, write, and execute/access permissions for everyone.

It's odd though, because those three directories show you at least have permission to access, read, and copy the files. Are these the folders you are trying to copy data _to_ or _from_? Maybe it's the permissions on the other locations that need to be adjusted?

As state above, the exact same thing happens under Windows 2000, XP, Vista, and 7 as well. Usernames are linked to a unique ID. So a user called "bob" from one Linux system might have a uid of 1000, where on another Linux system the user "bob" will have a uid of 1001. Migrating a Windows machine without changing the permissions on a folder will yield the same strange results. Even if you pick the same username, you will receive an error about "access denied" since the unique user IDs differ.

There is something else to consider. Even though you are changing the permissions for everything that exists _now_, any files that you create _afterwards_ will be "owned" by the LiveCD user called "ubuntu", not root. The only time they will be owned by root is if you create the new files as root. This is the drawback to using a LiveCD to solely manage your data.


----------



## halcour

Thanks for all the help! flan_suse your solution was the simplest and it worked fine. I even still have the permissions when I reboot back into Ubuntu (I suppose it must write to the hd's themselves for this.) This will making working with these hd's much easier than in Win 7, which was making me nuts. Thanks much.


----------

