move folder into root to prevent access

Asked by Cameron

Good day,

I need to know how to move a folder from a USB jump drive, into the root of the Ubuntu so then no one but the root can access the folder.

I need the command used to move it over to the root, the command is the main problem. Just give me the command to move the folder from the usb to the root.

Thank you! I've been working on this all morning I'm desperate!

-Cameron

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Cameron
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Harvey Muller (hlmuller) said :
#1

Good Day Cameron,

I will assume you know the path to the folder on the USB drive. I recommend you move it into the /root folder which is owned by root. It is in fact root's home folder. This is an example of the command you would use:

    $ sudo mv /media/sdb1/directory /root

Please report back here and modify the question status to Solved if this resolves your question.

Thanks!

Harvey

Revision history for this message
Cameron (cambradford) said :
#2

So that will move the folder from the usb drive to the root? We do know the path, by the way.

Thank you for responding and all your help it is greatly appreciated!

-Cameron

Revision history for this message
Harvey Muller (hlmuller) said :
#3

Cameron,

Yes, that will move the file to the root home directory, which is only accessible by root (or by a user with root access through sudo).

After you have run the command you can run the following in a terminal to confirm the operation:

    $ sudo ls /root
    $ ls /media/sdb1

The mv command would err out with a message anyway, if it couldn't perform the operation.

You would replace /media/sdb1 with the correct path of course. And to be concise, you would also replace 'directory' in the command in the first post, with the actual name of the directory.

Please report back here and change the status of the question to Solved if this resolves your issue.

Thanks!

Harvey

Revision history for this message
Cameron (cambradford) said :
#4

Thanks for all your time, however I've just ran into another issue.

My co workers and I are all trying to prepare these laptops to for student use. Well the PDF files that we use for the text books are not working right, since the pdf files use files from another folder with it's components. Well we create a shortcut t the main pdf, then that pdf gets its info from the folder with its components. Well the problem is we can't make shortcuts unless we move all the component folders into the location hat the main pdf is at. There are 13 main pdf files that we need. We could make 13 separate folders, but the students (7th graders) will not do that, and will use that as an excuse that they could not find it.

Revision history for this message
Harvey Muller (hlmuller) said :
#5

Cameron,

I think I see what your problem is. If I understand correctly, you are going to be asking the students to perform the mv, or copy operation we just performed? And if that is correct, you think the seventh graders won't be able to properly create all of the other different folders? If my understanding is correct, I will describe a more simple operation for you.

Thanks!

Harvey

p.s. The additional answer is extra credit!

Revision history for this message
Cameron (cambradford) said :
#6

Thanks Harvey, you almost got it.

Basically we need to put all the main pdf files someone on the computer, then have the component folders (the contents of the pdf files) hidden, otherwise the student can just delete the component files then they can delete it then they will use that an excuse to not to do their homework.

Thanks for any help,
Cam

Revision history for this message
Cameron (cambradford) said :
#7

That why we wanted to put the folders (component files) into the root sot hey oculdnt mess with them. Since we can't access the main pdf without having those files (component files).

Revision history for this message
Harvey Muller (hlmuller) said :
#8

Cameron,

I see. Then the solution we have been driving at isn't going to work, because the students will never have access to /root, at least they shouldn't!

We are now talking about a permissions issue. I think the solution then, is to give them Read rights only to the material that you do not want them deleting. This is a description of what I think your textbook looks like:

/path/textbook-main.pdf
/path/chap1/chap1.pdf
/path/chap1/extra-material.pdf
...

The textbook is in the main folder and there are subfolders with additional pdf material in them. Is this close to reality?

Thanks,

Harvey

Revision history for this message
Cameron (cambradford) said :
#9

Hi Harvey

What I'm doing now is on the desktop, I'm making a folder for each subject (English,Geography,Math) then I'm putting the component files in them.

Once I finish that I will post back.

Should take about 5 minutes.

Revision history for this message
Cameron (cambradford) said :
#10

Alright I have them all in folders on my desktop (linus desktop on Unbuntu)

I have 5 folders: Math,Literature,Civics,Geographic,English. So I guess now we need to figure out how to make it so the student can't delete the files, so then he/she can't say "I couldn't find the folder to do my homework."

Thanks for your help and support once agian!

~Cameron

Revision history for this message
Harvey Muller (hlmuller) said :
#11

Cameron,

Ok. I'm testing a scenario, and will get right back with you.

Harvey

Revision history for this message
Cameron (cambradford) said :
#12

Thank you!

I'll wait for you, take your time.

-Cam

Revision history for this message
Harvey Muller (hlmuller) said :
#13

Cameron,

I have to run home and pick up my rugrat from daycare. I will pick this up as soon as I get home. Will they be have access to a terminal and be able to run commands?

Thanks,

Harvey

Revision history for this message
Cameron (cambradford) said :
#14

They will not have access, they might be able to find it but they won't be a root so they can't do any harm or I hope not.

I'll wait for you, take your time I'll be leaving soon and head home as well.

Thanks again!

I really appreciate your help you have no idea.

-Cam

Revision history for this message
Harvey Muller (hlmuller) said :
#15

Cameron,

No problem! I have the solution. I was trying to implement a solution with all of the files on the desktop, but bumped into a problem. It isn't possible to delete the files with nautilus, but for some reason I was able to delete them as a user in a terminal (shell). And I'm sure there are some 7th graders that will be smart enough to figure that out also.

So the solution is to create a directory in /usr/local somewhere. I recommend perhaps /usr/local/share/textbook, where textbook is the name of the root directory for the textbook files. You could name it whatever you want.

In this solution, you would create all of the necessary directories as root:

    $ sudo mkdir /usr/local/share/textbook
    $ sudo mkdir /usr/local/share/textbook/subj1
    $ sudo mkdir /usr/local/share/textbook/subj2
    ... <and so on>

They should automatically be created with permissions 755. You can verify by running:

    $ ls -ld /usr/local/share/textbook

If the results show: drwxr-xr-x ... then your directories are set.

Then you want to populate your directories with the textbook files:

    $ sudo cp /path/to/file/filename.pdf /usr/local/share/textbook
    ... <and so on>

Then you want to change permissions of the textbook files so they cannot be deleted:

     $ sudo chmod 744 /usr/local/share/textbook/filename.pdf
     ... <and so on>

If I understand from what you said earlier, it sounds like you already know how to make links. You'll have to make them using sudo in that directory. Let me know if you get stumped on this.

After you have it all setup in the directory, then you can make a link on the Desktop to the main pdf file. We'll still have to engineer a solution to make sure the Desktop link cannot be deleted by the student. Once we have it all setup correctly, then I'll describe how to create an archive so you can easily replicate the directory across the student machines.

Thanks!

Harvey

Revision history for this message
Cameron (cambradford) said :
#16

I got your email, sorry for the late reply. I had to go out of town just got back today and our internet was down.

That tutorial helped a lot! We finally got it, we willb e doing more this upcoming work week and see how everything else goes. I'll let you know if we need anything else I'm sure we will....

Thanks you sooooo much for all your help!

~Cameron